Updated documentation for power-monitor
Added two undocumented events, added note that must be used after ready event.
This commit is contained in:
parent
29338e2fa4
commit
378e56e254
1 changed files with 17 additions and 3 deletions
|
@ -1,14 +1,20 @@
|
||||||
# power-monitor
|
# power-monitor
|
||||||
|
|
||||||
The `power-monitor` module is used to monitor the power state change. You can
|
The `power-monitor` module is used to monitor the power state change. You can
|
||||||
only use it on the main process.
|
only use it on the main process. You should not use this module until the `ready`
|
||||||
|
event of `app` module gets emitted.
|
||||||
|
|
||||||
An example is:
|
An example is:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
require('power-monitor').on('suspend', function() {
|
var app = require('app');
|
||||||
|
var powerMonitor = require('power-monitor');
|
||||||
|
|
||||||
|
app.on('ready', function() {
|
||||||
|
powerMonitor.on('suspend', function() {
|
||||||
console.log('The system is going to sleep');
|
console.log('The system is going to sleep');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Event: suspend
|
## Event: suspend
|
||||||
|
@ -18,3 +24,11 @@ Emitted when the system is suspending.
|
||||||
## Event: resume
|
## Event: resume
|
||||||
|
|
||||||
Emitted when system is resuming.
|
Emitted when system is resuming.
|
||||||
|
|
||||||
|
## Event: on-ac
|
||||||
|
|
||||||
|
Emitted when the system changes to AC power.
|
||||||
|
|
||||||
|
## Event: on-battery
|
||||||
|
|
||||||
|
Emitted when system changes to battery power.
|
||||||
|
|
Loading…
Reference in a new issue