Created
April 5, 2018 11:21
-
-
Save balajek/a3c20091a669df05aeee26ac82807c9a to your computer and use it in GitHub Desktop.
Adding event listeners for notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add listener for onClicked event. | |
browser.notifications.onClicked.addListener(function (notificationid) { | |
window.alert(notificationid + " clicked"); | |
}); | |
// Add listener for onButtonClicked event. | |
browser.notifications.onButtonClicked.addListener(function (notificationid, buttonIndex) { | |
window.alert("Button " + buttonIndex + " of " + notificationid + " clicked"); | |
}); | |
// Add listener for onClosed event. | |
browser.notifications.onClosed.addListener(function (notificationid, byUser) { | |
window.alert("Notification " + notificationid + " closed " + (byUser ? "by user" : "automatically due to timeout")); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment