On 9/29/06, sky <[EMAIL PROTECTED]> wrote: > > > > Two similar situations come up when I want to use it this way. > > > 1) When several things are going to change on the page that are > > > triggered from a loadJSONDoc or other xmlhttprequest. Most of them > > > aren't reliant on each other but on the original jsondoc > > > > So why can't these return the object they get? > > They could, but that's a more complex contract with the library than I > was hoping for
If you want to abstract "return x" then don't give them the Deferred object directly. > > > In both of these, signal/connect aren't what I'm looking for, because > > > the event may have been triggered already. > > > > I don't understand what you mean by "have been triggered already". I > > don't see how signals wouldn't be appropriate here. > Because, the sequence might look something like this: > 1. x = new Media() > 2. x loads successfully, and sends signal(this,'onload') > 3. something else loads, and wants to do something after 'onload' so: > connect(x,'onload',myfunc) > but myfunc() doesn't get called, because the signal has already been > sent. That's easy enough with a little abstraction. Deferreds aren't really intended for event broadcasting, they're generally ephemeral. > > One gigantic problem with your branching proposal is that errors get > > thrown away silently with no opportunity to catch them (unless error > > handling is in every callback). > Well, with some extra complexity if x.addCallbackBranch() returned a > new Deferred() that triggered off the new value, you could do error > checking down that Branch. Otherwise, the Branch is *supposed* to be a > leaf/branch rather than on the 'trunk' and the chain isn't supposed to > be affected by any error from the branch (just like in dev VC branches > :-) That also serializes everything. What you want is not a Deferred. Don't try and use one (directly) to do what you're doing. -bob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
