Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #30255

Re: Flow of execution

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Aleksandro <aleksandro@gmx.com>
Newsgroups comp.lang.javascript
Subject Re: Flow of execution
Date Sun, 10 Apr 2016 15:20:29 -0300
Organization A noiseless patient Spider
Lines 34
Message-ID <nee5b9$dnj$1@dont-email.me> (permalink)
References <ned84i$c2i$1@gioia.aioe.org> <MPG.317494198a6e9105989705@news.eternal-september.org>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
Injection-Date Sun, 10 Apr 2016 18:17:13 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="7363fa7664fe264696fafdff2cecae6a"; logging-data="14067"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18agz5htOw0kCo7gdjenhiFp3MMADvQnBQ="
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1
In-Reply-To <MPG.317494198a6e9105989705@news.eternal-september.org>
Cancel-Lock sha1:JnLuWKDHA/efMHr+3r7JK+HelUA=
Xref csiph.com comp.lang.javascript:30255

Show key headers only | View raw


On 10/04/16 13:48, Philip Herlihy wrote:
> In article <ned84i$c2i$1@gioia.aioe.org>, emfril@gmail.com says...
>>
>> If I add an alert at the end of the following function (from 
>> hmf.neocities.org/ix/is5.html):
>>
>> window.onload = function () {
>>      "use strict";
>>      document.getElementById("start").onclick = function () {
>>          requestFullScreen();
>>          init();
>>          alert("!"); // added alert
>>      };
>> };
>>
>> I would expect that when the Start button is clicked first the 
>> requestFullScreen() would execute, then the init(), and when that one 
>> has finished executing, the alert would come up. But obviously my 
>> reasoning is wrong, because the alert appears immediately after the html 
>> is loaded.
>>
>> I would greatly appreciate an explanation of the flow of execution in 
>> JavaScript.
>>
>> Thanks,
>>
>> Eustace
> 
> I've noticed anomalies in execution flow in JavaScript.  I can only 
> assume that browsers somehow "optimise" our code.  Very odd...

Are you kidding, right? We all here know Javascript's line of execution
can diverge when a function is asynchronous.

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Flow of execution emf <emfril@gmail.com> - 2016-04-10 05:58 -0400
  Re: Flow of execution Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-10 13:45 +0200
  Re: Flow of execution Philip Herlihy <thiswillbounceback@you.com> - 2016-04-10 17:48 +0100
    Re: Flow of execution Aleksandro <aleksandro@gmx.com> - 2016-04-10 15:20 -0300
  Re: Flow of execution "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-04-11 10:15 +0200
    Re: Flow of execution Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-12 00:34 +0200
    Re: Flow of execution / Full Screen mode emf <emfril@gmail.com> - 2016-04-11 21:57 -0400
      Re: Flow of execution / Full Screen mode Osmo Saarikumpu <osmo@weppipakki.com> - 2016-04-13 06:55 +0300
        Re: Flow of execution / Full Screen mode emf <emfril@gmail.com> - 2016-04-13 04:41 -0400
          Re: Flow of execution / Full Screen mode emf <emfril@gmail.com> - 2016-04-15 00:22 -0400
            Re: Flow of execution / Full Screen mode "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-04-15 12:53 -0700
            Re: Flow of execution / Full Screen mode Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-17 12:54 +0200
              Re: Flow of execution / Full Screen mode Nicholas Thayer <eatthecasket@gmail.com> - 2016-04-25 03:06 -0700
                Re: Flow of execution / Full Screen mode Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-04-25 21:48 +0200

csiph-web