PDA

View Full Version : Request: Adding handlers that only fire once



karga
12 Jul 2009, 4:26 AM
Hi,

I'm often in need of an event handler, that only fires once and then kills itself.. I'm using something like this


function fnLoad() {
//Load functionality
objTreeLoader.removeListener('load',fnLoad)
}
objTreeLoader.addListener('load',fnLoad)


Is it possible to to this in any other (simpler) way? Otherwise I would like to make this a request :)

Animal
12 Jul 2009, 4:44 AM
Read the DOCUMENTATION for addListener!!!!!!!

karga
12 Jul 2009, 4:55 AM
Woops, my bad :)

For others:

single : BooleanTrue to add a handler to handle just the next firing of the event, and then remove itself.