mirror of
https://github.com/electron/electron.git
synced 2026-01-25 07:18:18 -05:00
Merge pull request #1421 from tommoor/patch-2
Updated documentation for power-monitor
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
# power-monitor
|
||||
|
||||
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:
|
||||
|
||||
```javascript
|
||||
require('power-monitor').on('suspend', function() {
|
||||
console.log('The system is going to sleep');
|
||||
var app = require('app');
|
||||
|
||||
app.on('ready', function() {
|
||||
require('power-monitor').on('suspend', function() {
|
||||
console.log('The system is going to sleep');
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
@@ -18,3 +23,11 @@ Emitted when the system is suspending.
|
||||
## Event: resume
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user