So, I'm using custom non-DOM events. Works nice. Today, I discovered  
a problem:

var controller = {

        clickHandler: function(e) {
                disconnectAll(controller, 'onsave', 'ondiscard');
                connect(controller, 'onsave', bind('hideConfirm', view ));
                connect(controller, 'onsave', bind('changePage',controller, 
data));
                view.showConfirm();
        },

        changePage: function(data) {
                //do stuff, triggers subsequent XHR with callbacks
        }
}

var view = {
        showConfirm: function() {
                // shows modal dialog
        },

        hideConfirm: function() {
                // hides modal dialog
        }
}


connect ('someelement', 'onclick', controller.clickHandler);


The order of events in the clickHandler function seems to be of  
significance. If I define the hideConfirm() event AFTER the changePage 
() event, it never gets executed. If I defined it BEFORE (as shown  
above) both get executed.

I've tracked it down to one key difference in what the functions do.  
The hideConfirm() function simply hides the dialog which triggers no  
additional events.

The changePage() function causes a XHR to be executed which has it's  
own callbacks of course. So I have to assume that definition of a  
callBack on that subsequent XHR interrupts the current event chain,  
causing hideConfirm to never fire.

Is that a bug? Or is there some plausible explanation for it?

It's ok for me to reorder the events right now, but ultimately I'd  
like the dialog to be closed after or 'while' the XHR is executing.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---

Reply via email to