minibuffer: better support for input methods
[conkeror.git] / modules / timer.js
blob34c2f16ada6599758caf5685d3ce2e44ecd7d371
2 function timer_callback(callback) {
3     this.callback = callback;
5 timer_callback.prototype = {
6     QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback]),
8     notify : function(timer) {
9         this.callback.call(null, timer);
10     }
12 function call_after_timeout(callback, timeout) {
13     var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
14     timer.initWithCallback(new timer_callback(callback), timeout, Ci.nsITimer.TYPE_ONE_SHOT);
15     return timer;
18 function call_at_interval(callback, interval) {
19     var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
20     timer.initWithCallback(new timer_callback(callback), timeout, Ci.nsITimer.TYPE_REPEATING_SLACK);
21     return timer;
24 function call_at_precise_interval(callback, interval) {
25     var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
26     timer.initWithCallback(new timer_callback(callback), timeout, Ci.nsITimer.TYPE_REPEATING_PRECISE);
27     return timer;