aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorkumavis <kumavis@users.noreply.github.com>2016-06-03 08:30:17 +0800
committerkumavis <kumavis@users.noreply.github.com>2016-06-03 08:30:17 +0800
commit574b7424097583fb8e588d95c7596f30d2024065 (patch)
treed62ac510032f8e8cf10bff2f0a127ccffa38f25a /app/scripts
parent3b3c472dee5dcb349f955bf07de2efc069347f66 (diff)
parent90f494c9a1f822436d4b3cd5f9ddd52f27e43378 (diff)
downloadtangerine-wallet-browser-574b7424097583fb8e588d95c7596f30d2024065.tar
tangerine-wallet-browser-574b7424097583fb8e588d95c7596f30d2024065.tar.gz
tangerine-wallet-browser-574b7424097583fb8e588d95c7596f30d2024065.tar.bz2
tangerine-wallet-browser-574b7424097583fb8e588d95c7596f30d2024065.tar.lz
tangerine-wallet-browser-574b7424097583fb8e588d95c7596f30d2024065.tar.xz
tangerine-wallet-browser-574b7424097583fb8e588d95c7596f30d2024065.tar.zst
tangerine-wallet-browser-574b7424097583fb8e588d95c7596f30d2024065.zip
Merge pull request #241 from MetaMask/i236
fix illegal return statement :(
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/lib/notifications.js38
1 files changed, 22 insertions, 16 deletions
diff --git a/app/scripts/lib/notifications.js b/app/scripts/lib/notifications.js
index b72939196..90edaea12 100644
--- a/app/scripts/lib/notifications.js
+++ b/app/scripts/lib/notifications.js
@@ -8,24 +8,30 @@ module.exports = {
createMsgNotification: createMsgNotification,
}
-// guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236
-if (!chrome.notifications) return console.error('Chrome notifications API missing...')
+setupListeners()
-// notification button press
-chrome.notifications.onButtonClicked.addListener(function(notificationId, buttonIndex){
- var handlers = notificationHandlers[notificationId]
- if (buttonIndex === 0) {
- handlers.confirm()
- } else {
- handlers.cancel()
- }
- chrome.notifications.clear(notificationId)
-})
+function setupListeners(){
+
+ // guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236
+ if (!chrome.notifications) return console.error('Chrome notifications API missing...')
-// notification teardown
-chrome.notifications.onClosed.addListener(function(notificationId){
- delete notificationHandlers[notificationId]
-})
+ // notification button press
+ chrome.notifications.onButtonClicked.addListener(function(notificationId, buttonIndex){
+ var handlers = notificationHandlers[notificationId]
+ if (buttonIndex === 0) {
+ handlers.confirm()
+ } else {
+ handlers.cancel()
+ }
+ chrome.notifications.clear(notificationId)
+ })
+
+ // notification teardown
+ chrome.notifications.onClosed.addListener(function(notificationId){
+ delete notificationHandlers[notificationId]
+ })
+
+}
// creation helper
function createUnlockRequestNotification(opts){