From e808d51112837e5ccf9db1a5af485d2c9b308eda Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Fri, 25 Mar 2016 21:21:53 +0100 Subject: [PATCH] Update power-monitor module --- github-electron/github-electron-main-tests.ts | 9 +++++++ .../github-electron.power-monitor.d.ts | 24 +++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index a57f575503..a1b952889d 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -478,6 +478,15 @@ app.on('ready', () => { powerMonitor.on('suspend', () => { console.log('The system is going to sleep'); }); + powerMonitor.on('resume', () => { + console.log('The system has resumed from sleep'); + }); + powerMonitor.on('on-ac', () => { + console.log('The system changed to AC power') + }); + powerMonitor.on('on-battery', () => { + console.log('The system changed to battery power'); + }); }); // protocol diff --git a/github-electron/github-electron.power-monitor.d.ts b/github-electron/github-electron.power-monitor.d.ts index bc5427d265..a6eb577276 100644 --- a/github-electron/github-electron.power-monitor.d.ts +++ b/github-electron/github-electron.power-monitor.d.ts @@ -6,7 +6,27 @@ /// declare namespace Electron { - + /** + * The power-monitor module is used to monitor power state changes. + * You should not use this module until the ready event of the app module is emitted. + */ interface PowerMonitor extends NodeJS.EventEmitter { - } + /** + * Emitted when the system is suspending. + */ + on(event: 'suspend', listener: Function): this; + /** + * Emitted when system is resuming. + */ + on(event: 'resume', listener: Function): this; + /** + * Emitted when the system changes to AC power. + */ + on(event: 'on-ac', listener: Function): this; + /** + * Emitted when system changes to battery power. + */ + on(event: 'on-battery', listener: Function): this; + on(event: string, listener: Function): this; + } }