1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 21:37:58 +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

@@ -149,6 +149,7 @@ fieldset.paypal {
min-height: 18px !important; min-height: 18px !important;
border: none !important; border: none !important;
font-weight: bold; font-weight: bold;
font-family: monospace;
} }
#vimperator-statusline { #vimperator-statusline {
font-family: monospace; font-family: monospace;

View File

@@ -200,6 +200,13 @@ function Hints() //{{{
hintContainer.valid_hint_count++; // one more visible hint in this frame hintContainer.valid_hint_count++; // one more visible hint in this frame
linkCount++; // and one more total hint linkCount++; // and one more total hint
// process firefox event to keep the UI snappy
if (linkCount % 10 == 0)
{
Components.classes['@mozilla.org/thread-manager;1'].
getService().mainThread.processNextEvent(false);
}
} }
doc.coordsInvalidated = false; doc.coordsInvalidated = false;
@@ -455,6 +462,9 @@ function Hints() //{{{
} }
}; };
this.showHintsBackground = function()
{
}
this.reshowHints = function() this.reshowHints = function()
{ {

View File

@@ -760,7 +760,19 @@ const vimperator = (function() //{{{
vimperator.events.destroy(); vimperator.events.destroy();
window.dump("All vimperator modules destroyed\n"); 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);
} }
}
} //}}} } //}}}
})(); //}}} })(); //}}}