fix events registration issues

pull/433/head
sachaaaaa 6 years ago
parent ac4038e86a
commit 79d842635d

@ -198,10 +198,13 @@
}, },
showDevicePairingDialog() { showDevicePairingDialog() {
const dialog = new Whisper.DevicePairingDialogView(); const dialog = new Whisper.DevicePairingDialogView();
// remove all listeners for this events is fine since the
// only listener is right below.
Whisper.events.off('devicePairingRequestReceived');
Whisper.events.on('devicePairingRequestReceived', pubKey => Whisper.events.on('devicePairingRequestReceived', pubKey =>
dialog.requestReceived(pubKey) dialog.requestReceived(pubKey)
); );
dialog.on('devicePairingRequestAccepted', (pubKey, cb) => dialog.once('devicePairingRequestAccepted', (pubKey, cb) =>
Whisper.events.trigger('devicePairingRequestAccepted', pubKey, cb) Whisper.events.trigger('devicePairingRequestAccepted', pubKey, cb)
); );
this.el.append(dialog.el); this.el.append(dialog.el);

Loading…
Cancel
Save