Update power-save-blocker module

This commit is contained in:
Milan Burda
2016-03-26 01:56:55 +01:00
parent e808d51112
commit 8878c949db
2 changed files with 27 additions and 2 deletions
@@ -10,6 +10,7 @@ import {
Menu,
MenuItem,
powerMonitor,
powerSaveBlocker,
protocol,
Tray,
clipboard,
@@ -489,6 +490,14 @@ app.on('ready', () => {
});
});
// power-save-blocker
// https://github.com/atom/electron/blob/master/docs/api/power-save-blocker.md
var id = powerSaveBlocker.start('prevent-display-sleep');
console.log(powerSaveBlocker.isStarted(id));
powerSaveBlocker.stop(id);
// protocol
// https://github.com/atom/electron/blob/master/docs/api/protocol.md
+18 -2
View File
@@ -4,10 +4,26 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Electron {
/**
* The powerSaveBlocker module is used to block the system from entering
* low-power (sleep) mode and thus allowing the app to keep the system and screen active.
*/
interface PowerSaveBlocker {
start(type: string): number;
/**
* Starts preventing the system from entering lower-power mode.
* @returns an integer identifying the power save blocker.
* Note: prevent-display-sleep has higher has precedence over prevent-app-suspension.
*/
start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
/**
* @param id The power save blocker id returned by powerSaveBlocker.start.
* Stops the specified power save blocker.
*/
stop(id: number): void;
/**
* @param id The power save blocker id returned by powerSaveBlocker.start.
* @returns a boolean whether the corresponding powerSaveBlocker has started.
*/
isStarted(id: number): boolean;
}
}