diff options
author | Maximilian Krambach <[email protected]> | 2018-05-03 12:12:10 +0000 |
---|---|---|
committer | Maximilian Krambach <[email protected]> | 2018-05-03 12:12:10 +0000 |
commit | 6f67814eb45725bc7f3736a2638bad0a7470f17a (patch) | |
tree | a2958b05e9f6bb127a0c815dd2a12504465be550 /lang/js/src/index.js | |
parent | js: more testing (diff) | |
download | gpgme-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 'lang/js/src/index.js')
-rw-r--r-- | lang/js/src/index.js | 7 |
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)); |