aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2016-06-03 08:29:49 +0800
committerkumavis <aaron@kumavis.me>2016-06-03 08:29:49 +0800
commit90f494c9a1f822436d4b3cd5f9ddd52f27e43378 (patch)
tree3768ca374cee6338aef12cd4e1be89ff3352162d /app
parentc04d33c6a54dfb5c6ba779a79e19d8f06910ed9f (diff)
downloadtangerine-wallet-browser-90f494c9a1f822436d4b3cd5f9ddd52f27e43378.tar
tangerine-wallet-browser-90f494c9a1f822436d4b3cd5f9ddd52f27e43378.tar.gz
tangerine-wallet-browser-90f494c9a1f822436d4b3cd5f9ddd52f27e43378.tar.bz2
tangerine-wallet-browser-90f494c9a1f822436d4b3cd5f9ddd52f27e43378.tar.lz
tangerine-wallet-browser-90f494c9a1f822436d4b3cd5f9ddd52f27e43378.tar.xz
tangerine-wallet-browser-90f494c9a1f822436d4b3cd5f9ddd52f27e43378.tar.zst
tangerine-wallet-browser-90f494c9a1f822436d4b3cd5f9ddd52f27e43378.zip
fix illegal return statement :(
Diffstat (limited to 'app')
-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){