mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-03 18:34:12 +01:00
First work towards cleaning up the commandline.js rat's nest. Don't expect any of these new interfaces to stay remotely as they are.
--HG-- branch : key-processing
This commit is contained in:
@@ -985,9 +985,10 @@ let StructBase = Class("StructBase", Array, {
|
||||
});
|
||||
|
||||
var Timer = Class("Timer", {
|
||||
init: function (minInterval, maxInterval, callback) {
|
||||
init: function (minInterval, maxInterval, callback, self) {
|
||||
this._timer = services.Timer();
|
||||
this.callback = callback;
|
||||
this.self = self || this;
|
||||
this.minInterval = minInterval;
|
||||
this.maxInterval = maxInterval;
|
||||
this.doneAt = 0;
|
||||
@@ -1004,7 +1005,7 @@ var Timer = Class("Timer", {
|
||||
// minInterval is the time between the completion of the command and the next firing
|
||||
this.doneAt = Date.now() + this.minInterval;
|
||||
|
||||
this.callback(this.arg);
|
||||
this.callback.call(this.self, this.arg);
|
||||
}
|
||||
catch (e) {
|
||||
if (typeof util === "undefined")
|
||||
@@ -1042,8 +1043,8 @@ var Timer = Class("Timer", {
|
||||
this.doneAt = 0;
|
||||
},
|
||||
|
||||
flush: function () {
|
||||
if (this.doneAt == -1)
|
||||
flush: function (force) {
|
||||
if (this.doneAt == -1 || force)
|
||||
this.notify();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user