mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-06 08:54:12 +01:00
Add timeout arg to util.waitFor.
--HG-- branch : key-processing
This commit is contained in:
@@ -1526,8 +1526,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
|
||||
this.yielders--;
|
||||
}
|
||||
},
|
||||
waitFor: function waitFor(test, self, interruptable) {
|
||||
while (!test.call(self))
|
||||
waitFor: function waitFor(test, self, timeout, interruptable) {
|
||||
let end = timeout && Date.now() + timeout;
|
||||
while ((!end || Date.now() < end) && !test.call(self))
|
||||
this.threadYield(false, interruptable);
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user