-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadItem.js
More file actions
29 lines (24 loc) · 738 Bytes
/
readItem.js
File metadata and controls
29 lines (24 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const bytenode = require('bytenode');
const v8 = require('v8');
const {BrowserWindow} = require('electron');
let offscreenWindow
module.exports = (url, callback) => {
offscreenWindow = new BrowserWindow ({
width:500,
height:500,
show:false,
webPreferences: {
offscreen:true
}
})
offscreenWindow.loadURL(url)
offscreenWindow.webContents.on('did-finish-load', e=>{
let title = offscreenWindow.getTitle();
offscreenWindow.webContents.capturePage().then( image => {
let screenshot = image.toDataURL()
callback({title, screenshot, url })
offscreenWindow.close();
offscreenWindow = null;
})
})
}