From 79d842635da7317f20051b342436140c724df2f9 Mon Sep 17 00:00:00 2001 From: sachaaaaa Date: Mon, 26 Aug 2019 15:45:56 +1000 Subject: [PATCH] fix events registration issues --- js/views/app_view.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/views/app_view.js b/js/views/app_view.js index 364e758e3..b23ce8223 100644 --- a/js/views/app_view.js +++ b/js/views/app_view.js @@ -198,10 +198,13 @@ }, showDevicePairingDialog() { 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 => dialog.requestReceived(pubKey) ); - dialog.on('devicePairingRequestAccepted', (pubKey, cb) => + dialog.once('devicePairingRequestAccepted', (pubKey, cb) => Whisper.events.trigger('devicePairingRequestAccepted', pubKey, cb) ); this.el.append(dialog.el);