|
|
@ -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
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|