ks-electron-capture-screen
v0.1.1
Published
基于 electron-capture-screen 修改
Downloads
1
Readme
electron-capture-screen
electron截图插件
安装
yarn add electron-capture-screen
如果使用了webpack打包主进程,需要在webpack配置中添加:
module.exports = {
// ....
externals: {
'electron-capture-screen': 'require("electron-capture-screen")'
}
}
使用
import {app, globalShortcut} from 'electron';
import CaptureScreen from 'electron-capture-screen';
// ready之后实例化
app.on('ready', () => {
const captureScreen = new CaptureScreen();
globalShortcut.register('ctrl+alt+a', () => {
captureScreen.init();
});
globalShortcut.register('Esc', () => {
captureScreen.hide();
});
// 获取截图信息, 已写入剪切板
captureScreen.on('capture', dataURL => {
console.log(dataURL);
});
});