正在显示
3 个修改的文件
包含
51 行增加
和
0 行删除
.gitignore
0 → 100644
main.js
0 → 100644
| 1 | +const {app, BrowserWindow} = require('electron') | ||
| 2 | + | ||
| 3 | +app.disableHardwareAcceleration() | ||
| 4 | + | ||
| 5 | +let win | ||
| 6 | +app.once('ready', () => { | ||
| 7 | + win = new BrowserWindow({ | ||
| 8 | + webPreferences: { | ||
| 9 | + offscreen: true | ||
| 10 | + } | ||
| 11 | + }) | ||
| 12 | + win.loadURL('http://github.com') | ||
| 13 | + | ||
| 14 | + var now = Date.now() | ||
| 15 | + | ||
| 16 | + win.webContents.on("paint", function(event, dirty, image){ | ||
| 17 | + console.log( | ||
| 18 | + "painting", | ||
| 19 | + Date.now() - now, | ||
| 20 | + win.webContents.isOffscreen(), | ||
| 21 | + win.webContents.getFrameRate() | ||
| 22 | + ) | ||
| 23 | + | ||
| 24 | + now = Date.now() | ||
| 25 | + }) | ||
| 26 | + win.webContents.setFrameRate(20) | ||
| 27 | +}) |
package.json
0 → 100644
| 1 | +{ | ||
| 2 | + "name": "webpage_recorder", | ||
| 3 | + "version": "1.0.0", | ||
| 4 | + "description": "render web page offline and record to media file", | ||
| 5 | + "main": "main.js", | ||
| 6 | + "scripts": { | ||
| 7 | + "test": "echo \"Error: no test specified\" && exit 1" | ||
| 8 | + }, | ||
| 9 | + "keywords": [ | ||
| 10 | + "render", | ||
| 11 | + "record", | ||
| 12 | + "offline" | ||
| 13 | + ], | ||
| 14 | + "author": "hubin", | ||
| 15 | + "license": "MIT", | ||
| 16 | + "dependencies": { | ||
| 17 | + "electron": "^1.6.11" | ||
| 18 | + }, | ||
| 19 | + "devDependencies": { | ||
| 20 | + "electron-packager": "^8.7.2" | ||
| 21 | + } | ||
| 22 | +} |
-
请 注册 或 登录 后发表评论