remove listener on clicked notification

This commit is contained in:
vbaranov 2018-10-29 17:12:08 +03:00
parent 6fed8e7f8c
commit 3b878f3dba
1 changed files with 7 additions and 6 deletions

View File

@ -109,15 +109,16 @@ class ExtensionPlatform {
}) })
} }
_subscribeToNotificationClicked () { _subscribeToNotificationClicked = () => {
if (!extension.notifications.onClicked.hasListener(this._viewOnEtherScan)) { if (!extension.notifications.onClicked.hasListener(this._viewOnExplorer)) {
extension.notifications.onClicked.addListener(this._viewOnEtherScan) extension.notifications.onClicked.addListener((url) => this._viewOnExplorer(url))
} }
} }
_viewOnEtherScan (txId) { _viewOnExplorer (url) {
if (txId.startsWith('http://') || txId.startsWith('https://')) { if (url.startsWith('http://') || url.startsWith('https://')) {
global.metamaskController.platform.openWindow({ url: txId }) extension.notifications.onClicked.removeListener(this._viewOnExplorer)
global.metamaskController.platform.openWindow({ url })
} }
} }