c# - Can IE execute 2 JavaScript functions concurrently -


we using watin c# interact browser (currently ie).

some of watin's methods simple wrapper sends "onchanged()" , "onclick()" web elements.

watin provides fire-and-forget version this, provides non blocking version.

my question is, browser 2 js functions execute @ same time?

for example, assume following code:

// uses fireeventasync("onchanged") selectlist.selectnowait()  selectlist.fireeventasync("onclick") 

can both js functions onclick , onchanged execute @ once?

i believe experiencing similar issue, onchanged() function still executing while fire event, wondering if technically possible.

in short: no. javascript execution single-threaded.

however, asynchronous operations (ajax, timers, workers, etc.), parts of function can setup executed later when thread free.

a contrived example be:

function foo() {     settimeout(function () {         console.log('three');     }, 10);      console.log('one'); }  function bar() {     console.log('two'); }  foo(); bar(); 

though foo , bar called synchronously , logs written in order of three, one, two, executed in order of one, two, three timer delay log of 'three' later.

and, if handlers don't use asynchronous, selectnowait , fireeventasync do.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -