Mustafa,
very nice!
I once had trouble removing a listener (because it had an anonymous
handler function); I wonder if your script would work then, too? Didn't
get in touch wih qx.event.Registration or qx.event.Manager up to now.
If this code works as intended, I'd vote for it to get into the
framework. Valuable!
Greetings,
Stefan
On 04.07.2011 19:26, Mustafa Sak wrote:
> Hi List,
>
> I missed some day ago a useful function, to remove any event listener just
> by event type, without knowing the id or the reference to the event him
> self. May be useful for others:
>
> /**
> * TODOC
> *
> * @param target {void} any widget
> * @param eventType {string} any event type; e.g. 'execute'
> * @return {void}
> */
> removeListenerByType : function(target, eventType)
> {
> var listenerIds =
> qx.event.Registration.getManager(target).getListeners(target, eventType);
>
> if (listenerIds == null) {
> return;
> }
>
> for (var i=0; i<listenerIds.length; i++)
> {
> var listenerHandler = listenerIds[i].handler;
> var context = listenerIds[i].context;
> qx.event.Registration.getManager(target).removeListener(target,
> eventType, listenerHandler, context);
> }
> }
>
>
>
> SAKsystems
>
> Inh. Mustafa Sak
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel