Skip to content

Instantly share code, notes, and snippets.

Forked from zhchbin/index.html
Created December 28, 2013 12:00
What would you like to do?
<body style="background: #333">
<script >
var gui = require('nw.gui');
var win = gui.Window.get();
function takeSnapshot() {
win.capturePage(function(img) {
var popWindow ='popup.html',
{width: 420, height: 300});
popWindow.on('loaded', function() {
var image = popWindow.window.document.getElementById('image');
image.src = img;
}, 'png');
<div style="background: #123; width:100px; height:100px; border:1px solid
<button onclick="takeSnapshot()">Click me</button>
"name": "nw-api-demo",
"main": "index.html"
<title>Popup window</title>
width: 400;
<img id="image"/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment