I'm using jQuery proxy() to enable scope inside a handler when using addEventListener:
document.addEventListener('onSomeEvent', $.proxy(myHandler, this));
Now, normally when I want to remove event I used to call:
document.removeEventListener('onSomeEvent', myHandler, false);
How can I do that when using the $.proxy() option in jQuery?
var myHandlerProxied = $.proxy(myHandler, this);
document.addEventListener('onSomeEvent', myHandlerProxied);
document.removeEventListener('onSomeEvent', myHandlerProxied, false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With