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:
@@ -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 ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user