Javascript execution sequence problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stephan Parrot

    #1

    Javascript execution sequence problem

    Hello people!

    I have a really weird problem here...
    Let's say i have 4 lines of codes in a function like this one:


    SomeSVGDialog.S how(); //this is an SVG dialog box that shows to give
    some feedback
    FunctionCall1() ; //these functions calls webforms via XMLHTTP and
    erform stuff
    FunctionCall2() ;
    FunctionCall3() ;
    SomeSVGDialog.H ide();//thide the feedback window

    OK... The way I see it, the normal sequence of events would be, the
    feedback form is displayed, then, FunctionCall1, FunctionCall2 and
    FunctionCall3 are executed and then the feedback window would hide,
    right?

    WRONG!!!
    Right now, the feedback window isnt even displayed...
    all operations are performed but i dont see the feedback form showing
    up...
    I have found a quick fix to that but its not really pretty...
    I am doing this:

    SomeSVGDialog.S how();

    var DisplayTimer = setTimeout("Fun ctionCall1();Fu nctionCall2();F unctionCall3(); SomeSVGDialog.H ide();",
    500);

    this work perfectly!!

    Someone told me it may be because i am running the client javascript
    code on a machine with multiple processors... Which is correct but i
    didnt have the opportunity to test it on a single processor machine
    yet...
    In any case, id like to know if someone knows why this happens and how
    to fix it if possible because i cannot assume users will all have
    single CPU machines...

    Thanks in advance!

    Stephan Parrot
  • Ron

    #2
    Re: Javascript execution sequence problem

    "Stephan Parrot" <katraal@hotmai l.com> wrote in message
    news:355c614f.0 404061112.2c010 341@posting.goo gle.com...[color=blue]
    > Hello people!
    >
    > I have a really weird problem here...
    > Let's say i have 4 lines of codes in a function like this one:
    >
    >
    > SomeSVGDialog.S how(); //this is an SVG dialog box that shows to give
    > some feedback
    > FunctionCall1() ; //these functions calls webforms via XMLHTTP and
    > erform stuff
    > FunctionCall2() ;
    > FunctionCall3() ;
    > SomeSVGDialog.H ide();//thide the feedback window
    >
    > OK... The way I see it, the normal sequence of events would be, the
    > feedback form is displayed, then, FunctionCall1, FunctionCall2 and
    > FunctionCall3 are executed and then the feedback window would hide,
    > right?
    >
    > WRONG!!!
    > Right now, the feedback window isnt even displayed...
    > all operations are performed but i dont see the feedback form showing
    > up...
    > I have found a quick fix to that but its not really pretty...
    > I am doing this:
    >
    > SomeSVGDialog.S how();
    >
    > var DisplayTimer =[/color]
    setTimeout("Fun ctionCall1();Fu nctionCall2();F unctionCall3(); SomeSVGDialog.H i
    de();",[color=blue]
    > 500);
    >
    > this work perfectly!!
    >
    > Someone told me it may be because i am running the client javascript
    > code on a machine with multiple processors... Which is correct but i
    > didnt have the opportunity to test it on a single processor machine
    > yet...
    > In any case, id like to know if someone knows why this happens and how
    > to fix it if possible because i cannot assume users will all have
    > single CPU machines...
    >
    > Thanks in advance!
    >
    > Stephan Parrot[/color]

    Stephen,

    What happens if you add an Alert() to stall the program flow after the
    window open routine?

    I'm wondering if the time taken to launch the new window is more than the
    time taken to execute the other functions, so the window closes before you
    get to see it.
    Your workaround with a timer tends to support this.
    how about just commenting out the close window ? What happens then.

    HTH

    Ron


    Comment

    • Stephan Parrot

      #3
      Re: Javascript execution sequence problem

      Hi Ron, thanks for the reply!

      Ok... I tried to remove the .Hide call and the window is displayed after
      the 3 functions call after it...

      I've put alerts too... Before and after... went ok... sequentially...
      So... Either its the svg viwer pluggin that takes too much time to
      generate the svg from the javascript OR it's because the viewer wait for
      the function to exit before drawing it on screen... You know?
      The function must be interpreted entirely before letting the viewer do
      his job...

      In any ways, i'm stuck with the timer solution right now and i'm not
      happy with it...

      I'll do some other tests and try to speak with guys from the svg
      community if they know about that problem...

      If you have some explanation for me or anything that could be helpfull,
      please let me know!

      If i find the solution or if someone directs me to one, ill let the
      forum know.

      Thanks a lot!

      Stephan Parrot

      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      Working...