mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-09 12:51:09 +02:00
MozReview-Commit-ID: jYsePeTluZ --HG-- extra : rebase_source : 56da3e22cdd1d3f28a8f56ae969be63af4995432
18 lines
535 B
JavaScript
18 lines
535 B
JavaScript
"use strict";
|
|
|
|
XPCOMUtils.defineLazyServiceGetter(this, "idleService",
|
|
"@mozilla.org/widget/idleservice;1",
|
|
"nsIIdleService");
|
|
|
|
extensions.registerSchemaAPI("idle", "addon_parent", context => {
|
|
return {
|
|
idle: {
|
|
queryState: function(detectionIntervalInSeconds) {
|
|
if (idleService.idleTime < detectionIntervalInSeconds * 1000) {
|
|
return Promise.resolve("active");
|
|
}
|
|
return Promise.resolve("idle");
|
|
},
|
|
},
|
|
};
|
|
});
|