From 24545a1906d62c5c449bd0d2577eb25cd2e1071f Mon Sep 17 00:00:00 2001 From: David Walsh Date: Tue, 3 May 2022 16:36:32 -0500 Subject: [PATCH 1/2] Assign messageId via local variable --- index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index fb7d84dd..79c334e1 100644 --- a/index.js +++ b/index.js @@ -478,10 +478,11 @@ class LedgerBridgeKeyring extends EventEmitter { _sendMessage (msg, cb) { msg.target = 'LEDGER-IFRAME' - this.currentMessageId += 1 - msg.messageId = this.currentMessageId + const messageId = this.currentMessageId + 1; + this.currentMessageId = messageId + msg.messageId = messageId - this.messageCallbacks[this.currentMessageId] = cb + this.messageCallbacks[messageId] = cb this.iframe.contentWindow.postMessage(msg, '*') } From 12ad2e6dc0a96f30a04dcd34ef9866accc502b7b Mon Sep 17 00:00:00 2001 From: David Walsh Date: Mon, 9 May 2022 11:36:37 -0500 Subject: [PATCH 2/2] Lint fix --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 79c334e1..454549cd 100644 --- a/index.js +++ b/index.js @@ -478,7 +478,7 @@ class LedgerBridgeKeyring extends EventEmitter { _sendMessage (msg, cb) { msg.target = 'LEDGER-IFRAME' - const messageId = this.currentMessageId + 1; + const messageId = this.currentMessageId + 1 this.currentMessageId = messageId msg.messageId = messageId