Reputation: 1136
Im making a Firefox Addon in FF42 using the Addon SDK. I've also included an AngularJS app in the Addon, and in the app.js file, I've created an Event Listener as so
window.addEventListener("updateSimpleStorage", function($obj) {
console.log('updateSimpleStorage: ', $obj);
private_self_options.simpleStorage = $obj.detail;
});
and in my script.js I am sending out an Event as so
var e = new CustomEvent('updateSimpleStorage', {'detail': simpleStorage});
window.dispatchEvent(e);
So why is it that the eventlistener doesnt pick up on the event? Please point out my mistake? I feel its a scope issue but I cant put my finger on it.
Upvotes: 2
Views: 509
Reputation: 37228
There is a 3rd and 4th argument to addEventListener
.
The 3rd one you are familiar with, its the useCapture
. The 4th one is criticial in this case, because you want to capture events from unprivileged code. So you must set that to true
.
See these topics:
Upvotes: 2