the thing is, events DO do this for you, it's just that your event that you are calling itself has a timeout involved, and your class has no way of knowing that.
On Fri, Jan 15, 2010 at 10:48 AM, batman42ca <[email protected]> wrote: > My demo isn't far off from my real application. > > I've temporarily solved this in my real application by simply > attaching all the code to the onA event, not using the onB event, and > handling the chaining in the onA code. That works, but I was hoping to > make the class automate that for me. I suspected when I posted, to > find I can't make a class do what I want, but I thought I'd ask > anyway. > > On Jan 15, 1:32 pm, Aaron Newton <[email protected]> wrote: > > yes, but javascript is single threaded. At issue is that your events that > > you are attaching - the effects - are themselves asynchronous. They > contain > > timeouts. But your class that you're attaching these events to have no > > knowledge of this delay. So the problem is that you need to attach these > > events to the completed chain of the effects. The contract for Events and > > for Chain both say that they accept functions that they call and that's > all > > they know about. They don't know if those functions call ajax or effects > or > > wait for the user to do something. > > > > What you're trying to do is break that contract, where an event you > attach > > has some say in when the class to which you are attaching the event calls > > the next event. It's convoluted and basically a bad idea. Whatever you > are > > really trying to do (in your real work, not this demo), there's probably > a > > better way. > > > > > > > > On Fri, Jan 15, 2010 at 10:14 AM, batman42ca <[email protected]> > wrote: > > > Both events still fire at nearly the same time: > > > > >http://mootools.net/shell/M28PW/- Hide quoted text - > > > > - Show quoted text - >
