Hi everybody,

I am trying to listen to an event just once, but I don't get it to work. 
Here is my code:

/**
 * listens for an event just once
 * @param string event name
 * @param function handler function
 **/
zophe.event.once = function ( name, callbackFunc )
{
    var o  = { callback: function(e) {
        callbackFunc(e);
        zophe.event._remove ( this );
    } };
   
    window.application.addEventListener ( name, o.callback );
};

zophe.event._remove = function ( o )
{
    window.application.removeEventListener ( name, o.callback );
    delete ( o );
}

Now I do:

zophe.event.once( "requests-completed", function(){
    alert ( "all requests completed" );
 });

It will continue to call my alert function if a "request-completed" 
event is dispatched. Any ideas?

Christian



_______________________________________________
Qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to