View Full Version : Events: addEvent for adding, ... for removing?
nothing
2 Jul 2012, 5:25 AM
Hello,
I know there is a function "un" resp. "removeListener" for removing event handler, but how do I remove the event registered with "addEvent"?
Thanks.
skirtle
2 Jul 2012, 5:34 AM
You can't remove an event.
Why would you want to?
nothing
2 Jul 2012, 6:02 AM
Short: I just want to.
Long: If I dont need certain events anymore in my app, I want to remove them, so that they cannot be used anymore.
Why is that impossible?
Animal
2 Jul 2012, 7:12 AM
delete this.events.click;
this.hasListeners.click = 0;
As long as you know it has no listeners attached.
I can't see the point though.
stimpy
2 Jul 2012, 7:23 AM
If you are looking to stop actions you might also want to try
event.preventDefault();
which Prevents the browser from executing the default action. Use the method isDefaultPrevented to know whether this method was ever called (on that event object).or
event.stopPropagation();
which stops the bubbling of an event to parent elements, preventing any parent handlers from being notified of the event.
nothing
6 Jul 2012, 12:54 AM
Thanks guys.
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.