mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-18 12:33:17 +08:00
Update power-monitor module
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -6,7 +6,27 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user