]> khamidou — GitHub mirrors - electron.git/commitdiff
Fixed example with correct capturePage api.
authorLucidogen Media <admin@lucidogen.io>
Sat, 6 Jun 2015 11:20:47 +0000 (13:20 +0200)
committerLucidogen Media <admin@lucidogen.io>
Sat, 6 Jun 2015 11:20:47 +0000 (13:20 +0200)
docs/api/remote.md

index 345b0d5b132d0417ff320b3eec6a85f95e47eb8f..70703743b5f7374242651f47638bb6304ef5af6c 100644 (file)
@@ -97,7 +97,8 @@ returns a `Buffer` by calling the passed callback:
 ```javascript
 var remote = require('remote');
 var fs = require('fs');
-remote.getCurrentWindow().capturePage(function(buf) {
+remote.getCurrentWindow().capturePage(function(image) {
+  var buf = image.toPng()
   fs.writeFile('/tmp/screenshot.png', buf, function(err) {
     console.log(err);
   });
@@ -115,7 +116,8 @@ The work-around is to write the `buf` in the main process, where it is a real
 
 ```javascript
 var remote = require('remote');
-remote.getCurrentWindow().capturePage(function(buf) {
+remote.getCurrentWindow().capturePage(function(image) {
+  var buf = image.toPng()
   remote.require('fs').writeFile('/tmp/screenshot.png', buf, function(err) {
     console.log(err);
   });