PDA

View Full Version : Need help in synchornizing method calls



kondurucs
23 Apr 2008, 12:27 PM
Hi
I have 2 methods to be called one after another inside javascript. how can I make second call to wit until the first call to a method finishes its execution. i want it to be done using Ext
Thanks in advance
-Sekhar

kondurucs
23 Apr 2008, 12:28 PM
Hi
I have 2 methods to be called one after another inside javascript. how can I make second call to wit until the first call to a method finishes its execution. i want it to be done using Ext
Thanks in advance
-Sekhar

23 Apr 2008, 12:39 PM
setup a callback for the first method or, simply call method #2 after method#1 is done.

Lobos
23 Apr 2008, 12:41 PM
does this look like the support forums to you?

mjlecomte
23 Apr 2008, 1:17 PM
Some of your code would help here. Depends what you're doing. You could fire some other method from inside a success handler or other specified callback depending what you want to do.

mjlecomte
23 Apr 2008, 1:19 PM
Please don't post your question multiple times in multiple forums.

Animal
23 Apr 2008, 1:48 PM
The OP should explain more. I mean consider this:



doThis();
doThat();


doThat is only executed after doThis has finished. So what is he talking about? Ajax? We guess?

mystix
23 Apr 2008, 7:36 PM
[ merged OP's duplicate post from Examples forum ]

kondurucs
24 Apr 2008, 9:03 AM
Thanks for all ur suggestions. If I call method2 after method1 and if method1 takes considerable amount of time, because javascript is asynchronous , second method starts getting executed. Method1 is taking considerable amount of time and method2 starts getting executed even before method1 finishes. I will try set callback option and see.Thanks
-Sekhar

24 Apr 2008, 9:07 AM
javascript is NOT asynchronous unless you're doing setTimeout or XHRs. fn1(); fn2(); should work. Unless fn1 is doing some type of asynch call! then you need a callback.
fn1.callback = fn2;