mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-24 06:52:28 +01:00
new vimperator.sleep() method
This commit is contained in:
@@ -760,7 +760,19 @@ const vimperator = (function() //{{{
|
||||
vimperator.events.destroy();
|
||||
|
||||
window.dump("All vimperator modules destroyed\n");
|
||||
}
|
||||
},
|
||||
|
||||
sleep: function(ms)
|
||||
{
|
||||
var threadManager = Cc["@mozilla.org/thread-manager;1"].getService(Ci.nsIThreadManager);
|
||||
var mainThread = threadManager.mainThread;
|
||||
|
||||
var then = new Date().getTime(), now = then;
|
||||
for (; now - then < ms; now = new Date().getTime()) {
|
||||
mainThread.processNextEvent(true);
|
||||
}
|
||||
}
|
||||
|
||||
} //}}}
|
||||
})(); //}}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user