1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

fix illegal return statement :(

This commit is contained in:
kumavis 2016-06-02 17:29:49 -07:00
parent c04d33c6a5
commit 90f494c9a1

View File

@ -8,11 +8,15 @@ 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){
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 button press
chrome.notifications.onButtonClicked.addListener(function(notificationId, buttonIndex){
var handlers = notificationHandlers[notificationId]
if (buttonIndex === 0) {
handlers.confirm()
@ -20,12 +24,14 @@ chrome.notifications.onButtonClicked.addListener(function(notificationId, button
handlers.cancel()
}
chrome.notifications.clear(notificationId)
})
})
// notification teardown
chrome.notifications.onClosed.addListener(function(notificationId){
// notification teardown
chrome.notifications.onClosed.addListener(function(notificationId){
delete notificationHandlers[notificationId]
})
})
}
// creation helper
function createUnlockRequestNotification(opts){