I’m using the JayData.js library. It works quite well. However, I have a few situations where I’ve got a toArray() call deep in the function tree. Rather than trying to access my “busy” signal from there, I’d just as soon have the method block. Is that possible? I’m picturing something like “context.Groups.toArray(myObservableVar).block()”.
Update 1: It appears that the JayData library returns a jQuery deferred object judging from the use of “then” and “when” operators on the return value. Is there a corresponding method to “join” — meaning wait for the finish?
A
blockUntilDone()method would go against the principles of deferred execution and continuations. JayData’stoArray()is asynchronous because it is designed not to block the caller.If you want this kind of code:
Trying to block until the deferred is resolved is not the solution. Move the last part of your code into a callback passed to
toArray()instead:Alternatively, bind to the returned promise with done() or then():