I have some problem in firefox add-on/jetpack.
There its the event listener:
tab.on('deactivate', cleardata);
I need delete the deactivate event listener.
I guess I need something like that
tab.removeListener('deactivate', cleardata);
But something was wrong in the code, dont stop the listener.
The following snippet works as expected for me:
var count = 0;
function myListener(tab) {
count++;
console.log("Event number " + count);
if (count == 3)
{
console.log("Removing listener after third event");
tab.removeListener('deactivate', myListener);
}
}
function setupTabTest(tab) {
tab.on('deactivate', myListener);
}
(You need to call setupTabTest with some existing Tab object.)
Does this code work for you? If so, please give more information about the part of your code which is not working. Try to reduce it to the simplest example which illustrates the error.