On Monday, 2 December 2013 17:01:40 UTC, Mark Manning  wrote:
> Javascript, by itself, does not have a wait function.  However, you
>     can create a pseudo wait function by doing the following:
> [snip]

This code won't work.

>     the timeout retains its own return information
>     about where it came from.  Basically, javascript splits (or does a
>     fork) on the timeout. 

No, it doesn't, it just schedules a an expression to be executed after a 
certain amount of time (in this case, to `mch_delay()`). If you wanted 
execution to continue, you'd have to add some sort of callback back into 
gui_start which would jump to the start of the while loop. This is a pretty 
non-trivial code change.

Instead, the code that follows the while loop should be the callback of some 
'keydown' handler -- still a very non-trivial code change, vim's synchronous 
"wait for input" style code doesn't cooperate well with javascript asynchronous 
event-driven input model.

> The thing to note is - you have to take the false return into
> consideration.  The problem with Javascript is two fold: 1)No sleep
> function, and 2)No END/EXIT function either.  In looking for a way to
> exit a program I found this:

Please never use this code, all it does is irrecoverably disable any and all 
interaction on the current webpage and throws an exception. This is pretty much 
equivalent to a process being "exited" by entering an empty while loop, 
disables interaction without doing anything useful.

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui