]> khamidou — GitHub mirrors - electron.git/commitdiff
Updated documentation for power-monitor
authorTom Moor <tom.moor@gmail.com>
Wed, 15 Apr 2015 04:03:58 +0000 (21:03 -0700)
committerTom Moor <tom.moor@gmail.com>
Wed, 15 Apr 2015 04:03:58 +0000 (21:03 -0700)
Added two undocumented events, added note that must be used after ready event.

docs/api/power-monitor.md

index 5ead769aa34c76c1e32093caaecf4d590bb71444..9273e13d9a59f346f973c53db999a4457c251f71 100644 (file)
@@ -1,13 +1,19 @@
 # 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');
+var powerMonitor = require('power-monitor');
+
+app.on('ready', function() {
+  powerMonitor.on('suspend', function() {
+    console.log('The system is going to sleep');
+  });
 });
 ```
 
@@ -18,3 +24,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.