Mon 27 Jun 2011

Logging idle time in Firefox

This will log idle events and back events into the Web Console in Firefox. Useful if you're trying to figure out why your idle timer isn't firing when you expect it to.

var idleObserver = {
  observe: function(subject, topic, data) {
    console.log(topic + " " + subject.idleTime);
  }
};
            
var idleService = Components.classes["@mozilla.org/widget/idleservice;1"]
                    .getService(Components.interfaces.nsIIdleService);
idleService.addIdleObserver(idleObserver, 10);

Posted at 2011-06-27 13:37:00 by Richard NewmanLink to Logging idle time …