aboutsummaryrefslogtreecommitdiffstats
path: root/lang/js/src/index.js
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-05-03 12:12:10 +0000
committerMaximilian Krambach <[email protected]>2018-05-03 12:12:10 +0000
commit6f67814eb45725bc7f3736a2638bad0a7470f17a (patch)
treea2958b05e9f6bb127a0c815dd2a12504465be550 /lang/js/src/index.js
parentjs: more testing (diff)
downloadgpgme-6f67814eb45725bc7f3736a2638bad0a7470f17a.tar.gz
gpgme-6f67814eb45725bc7f3736a2638bad0a7470f17a.zip
js: changed Key class stub
-- * src/Key.js: A Key object cannot offer more than basic functionality outside a connection, so it now requires a connection to be present.
Diffstat (limited to '')
-rw-r--r--lang/js/src/index.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/lang/js/src/index.js b/lang/js/src/index.js
index 90fe99e3..fc406c66 100644
--- a/lang/js/src/index.js
+++ b/lang/js/src/index.js
@@ -36,9 +36,12 @@ function init(config){
return new Promise(function(resolve, reject){
let connection = new Connection;
// TODO: Delayed reaction is ugly. We need to listen to the port's
- // event listener in isConnected, but this takes some time (<5ms) to
- // disconnect if there is no successfull connection.
+ // event listener in isConnected, but in some cases this takes some
+ // time (<5ms) to disconnect if there is no successfull connection.
let delayedreaction = function(){
+ if (connection === undefined) {
+ reject(gpgme_error('CONN_NO_CONNECT'));
+ }
if (connection.isConnected === true){
if (_conf.api_style && _conf.api_style === 'gpgme_openpgpjs'){
resolve(new GpgME_openpgpmode(connection, _conf));