I can not seem to have the receiver event listener removed. Given the code below the console will continue printing "hi" endlessly.
Receiver:
window.addEventListener("message", function(e){
console.log('hi');
window.removeEventListener("message", function(e){}, false)
}, false);
Sender :
var emiter = setInterval(function(){
console.log('sending message');
window.parent.postMessage( messageData, "*" );
}, 1000);
Is there a way around this ?