function myFunction() {
wait(); //what I put there?
return;
}
myFunction();
//this is an event; when its triggered I want function to resume
onSomething = function() {
myFunction.resume(); //what I put there?
}
这只是一种本地体验。请注意,while(!resume) 将不起作用,因为这会阻止事件 onSomething 的发生。
最佳答案
这是不可能的。
与其等待事件发生,不如将事件发生时需要做的任何事情放入 onSomething
函数中。
关于javascript - 在返回之前制作一个等待事件的函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8027392/