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

Merge pull request #241 from MetaMask/i236

fix illegal return statement :(
This commit is contained in:
kumavis 2016-06-02 17:30:17 -07:00
commit 574b742409

View File

@ -8,11 +8,15 @@ module.exports = {
createMsgNotification: createMsgNotification, createMsgNotification: createMsgNotification,
} }
// guard for chrome bug https://github.com/MetaMask/metamask-plugin/issues/236 setupListeners()
if (!chrome.notifications) return console.error('Chrome notifications API missing...')
// notification button press function setupListeners(){
chrome.notifications.onButtonClicked.addListener(function(notificationId, buttonIndex){
// 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] var handlers = notificationHandlers[notificationId]
if (buttonIndex === 0) { if (buttonIndex === 0) {
handlers.confirm() handlers.confirm()
@ -20,12 +24,14 @@ chrome.notifications.onButtonClicked.addListener(function(notificationId, button
handlers.cancel() handlers.cancel()
} }
chrome.notifications.clear(notificationId) chrome.notifications.clear(notificationId)
}) })
// notification teardown // notification teardown
chrome.notifications.onClosed.addListener(function(notificationId){ chrome.notifications.onClosed.addListener(function(notificationId){
delete notificationHandlers[notificationId] delete notificationHandlers[notificationId]
}) })
}
// creation helper // creation helper
function createUnlockRequestNotification(opts){ function createUnlockRequestNotification(opts){