timers: Move list.ontimeout to separate function
This commit is contained in:
parent
aec2f733f9
commit
ba94f9d6f8
@ -66,12 +66,22 @@ function insert(item, msecs) {
|
||||
L.init(list);
|
||||
|
||||
lists[msecs] = list;
|
||||
list.msecs = msecs;
|
||||
list.ontimeout = listOnTimeout;
|
||||
}
|
||||
|
||||
L.append(list, item);
|
||||
assert(!L.isEmpty(list)); // list is not empty
|
||||
}
|
||||
|
||||
function listOnTimeout() {
|
||||
var msecs = this.msecs;
|
||||
var list = this;
|
||||
|
||||
list.ontimeout = function() {
|
||||
debug('timeout callback ' + msecs);
|
||||
|
||||
var now = Date.now();
|
||||
debug('now: ' + (new Date(now)));
|
||||
debug('now: ' + now);
|
||||
|
||||
var first;
|
||||
while (first = L.peek(list)) {
|
||||
@ -115,11 +125,6 @@ function insert(item, msecs) {
|
||||
assert(L.isEmpty(list));
|
||||
list.close();
|
||||
delete lists[msecs];
|
||||
};
|
||||
}
|
||||
|
||||
L.append(list, item);
|
||||
assert(!L.isEmpty(list)); // list is not empty
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,5 +3,5 @@
|
||||
^
|
||||
ReferenceError: undefined_reference_error_maker is not defined
|
||||
at null._onTimeout (*test*message*timeout_throw.js:*:*)
|
||||
at Timer.list.ontimeout (timers.js:*:*)
|
||||
at Timer.listOnTimeout [as ontimeout] (timers.js:*:*)
|
||||
at process._makeCallback (node.js:*:*)
|
||||
|
Loading…
x
Reference in New Issue
Block a user