I have this code:
chrome.tabs.onUpdated.addListener(function(callback){
var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
eventer(messageEvent,function(e) {//script});
});
I want to remove the second listener after it has fired (chronologically the first one fires first, then the second one fires when it gets a message).
I really don't understand the syntax of the .removeEventListener function and how to apply it on my example. I already read that it doesn't work with anonymous functions in the listeners so I had to declare the functions first, is that right?
Thanks for any help.