time delay between 2 lines of code in javascript, not settimeout -


There is a function that will add a time delay between the two lines of code, not the set timeout, because settimeout is a function in its arguments / Object is required.

I'm looking for something like this pseudo code

  Write "abc"; Delay (500); Write "xyz";  

TIA

Edit: In my second work, Jemar's solution worked for my purpose, and likewise of Robusto

I'm just thinking that "sleeping" methods given by Robosto and CMS links are not liked, how will this set different from the timeout method because they start a break in both codes? (Prevents the set timeout before the execution of the function, the sleep method prevents the next line before execution.)

The following is clutter and ugly and I can never do it in my code and I do not recommend it to everyone , but it shows that such a thing is possible.

  // time argument is in millisecond function delay (time) {var d1 = new date (); Var d2 = new date (); While (d2.valueOf () & lt; d1.valueOf () + time) {d2 = New date (); }}  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -