This PR replaces the handler for browser.notification.onClicked.addListener with a named function, which avoids re-registering the handler on every call to addHandlers.
Note that addEventListener called repeatedly with the same arguments will not register the same event listener multiple times (see the EventTarget.addEventListener spec for more info). This means that using the same named function for each call to addHandlers will only call that function once, where the previous code added a new anonymous function for each call.
This fixes #234, where clicking a notification would result in multiple tabs being opened, depending on the number of times that addHandlers was called.
This PR replaces the handler for
browser.notification.onClicked.addListener
with a named function, which avoids re-registering the handler on every call toaddHandlers
.Note that
addEventListener
called repeatedly with the same arguments will not register the same event listener multiple times (see theEventTarget.addEventListener
spec for more info). This means that using the same named function for each call toaddHandlers
will only call that function once, where the previous code added a new anonymous function for each call.This fixes #234, where clicking a notification would result in multiple tabs being opened, depending on the number of times that
addHandlers
was called.