create_buffer() expects a window as its first argument, not a buffer.
[conkeror.git] / modules / timer.js
blob6c3dc8ffae0126e29c195c92ad8b47a6d7108426
1 /**
2  * (C) Copyright 2008 Jeremy Maitin-Shepard
3  *
4  * Use, modification, and distribution are subject to the terms specified in the
5  * COPYING file.
6 **/
8 function timer_callback(callback) {
9     this.callback = callback;
11 timer_callback.prototype = {
12     QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback]),
14     notify : function(timer) {
15         this.callback.call(null, timer);
16     }
18 function call_after_timeout(callback, timeout) {
19     var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
20     timer.initWithCallback(new timer_callback(callback), timeout, Ci.nsITimer.TYPE_ONE_SHOT);
21     return timer;
24 function call_at_interval(callback, interval) {
25     var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
26     timer.initWithCallback(new timer_callback(callback), interval, Ci.nsITimer.TYPE_REPEATING_SLACK);
27     return timer;
30 function call_at_precise_interval(callback, interval) {
31     var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
32     timer.initWithCallback(new timer_callback(callback), interval, Ci.nsITimer.TYPE_REPEATING_PRECISE);
33     return timer;