Added/Updated idle /w docs

This commit is contained in:
Fredrik Høisæther Rasch
2015-08-24 11:04:00 +02:00
parent 4563762025
commit af039e87dd
+24 -1
View File
@@ -3807,13 +3807,36 @@ declare module chrome.identity {
////////////////////
// Idle
////////////////////
/**
* Use the chrome.idle API to detect when the machine's idle state changes.
* Permissions: "idle"
* @since Chrome 6.
*/
declare module chrome.idle {
interface IdleStateChangedEvent extends chrome.events.Event {
/**
* @param callback The callback parameter should be a function that looks like this:
* function( IdleState newState) {...};
*/
addListener(callback: (newState: string) => void): void;
}
export function queryState(thresholdSeconds: number, callback: (newState: string) => void): void;
/**
* Returns "locked" if the system is locked, "idle" if the user has not generated any input for a specified number of seconds, or "active" otherwise.
* @param detectionIntervalInSeconds The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected.
* Since Chrome 25.
* @param callback The callback parameter should be a function that looks like this:
* function( IdleState newState) {...};
*/
export function queryState(detectionIntervalInSeconds: number, callback: (newState: string) => void): void;
/**
* Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds.
* @since Chrome 25.
* @param intervalInSeconds Threshold, in seconds, used to determine when the system is in an idle state.
*/
export function setDetectionInterval(intervalInSeconds: number): void;
/** Fired when the system changes to an active, idle or locked state. The event fires with "locked" if the screen is locked or the screensaver activates, "idle" if the system is unlocked and the user has not generated any input for a specified number of seconds, and "active" when the user generates input on an idle system. */
var onStateChanged: IdleStateChangedEvent;
}