1
0
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:
Martin Stubenschrott
2007-09-25 05:41:29 +00:00
parent eda409c78b
commit 89fa440ba2
3 changed files with 24 additions and 1 deletions

View File

@@ -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);
}
}
} //}}}
})(); //}}}