1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 16:52:25 +01:00

Allow :time to be interrupted

This commit is contained in:
Kris Maglione
2008-10-12 18:58:32 +00:00
parent afcd5cbaeb
commit 0f92110012
3 changed files with 30 additions and 20 deletions

View File

@@ -295,6 +295,23 @@ liberator.util = { //{{{
yield start++;
},
rangeInterruptable: function (start, end, time)
{
let endTime = Date.now() + time;
while (start < end)
{
if (Date.now() > endTime)
{
liberator.interrupted = false;
liberator.threadYield();
if (liberator.interrupted)
throw new Error("Interrupted");
endTime = Date.now() + time;
}
yield start++;
}
},
// same as Firefox's readFromClipboard function, but needed for apps like Thunderbird
readFromClipboard: function ()
{