PDA

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


karga
07-12-2009, 07: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
07-12-2009, 07:44 AM
Read the DOCUMENTATION for addListener!!!!!!!

karga
07-12-2009, 07: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.