mirror of
https://github.com/rubickCenter/rubick
synced 2025-12-20 01:58:04 +08:00
⚡ 截图功能优化
This commit is contained in:
@@ -11,11 +11,10 @@ import {
|
||||
} from 'electron';
|
||||
import { runner, detach } from '../browsers';
|
||||
import fs from 'fs';
|
||||
import { LocalDb } from '@/core';
|
||||
import { LocalDb, screenCapture } from '@/core';
|
||||
import plist from 'plist';
|
||||
import { DECODE_KEY } from '@/common/constans/main';
|
||||
import mainInstance from '../index';
|
||||
import { screenshots } from './registerScreenshots';
|
||||
const runnerInstance = runner();
|
||||
const detachInstance = detach();
|
||||
const dbInstance = new LocalDb(app.getPath('userData'));
|
||||
@@ -34,14 +33,6 @@ class API {
|
||||
event.returnValue = data;
|
||||
// event.sender.send(`msg-back-${arg.type}`, data);
|
||||
});
|
||||
|
||||
// 注册截屏成功回调事件
|
||||
screenshots.on('ok', (e, buffer) => {
|
||||
const image = nativeImage.createFromBuffer(buffer);
|
||||
runnerInstance.executeHooks('ScreenCapture', {
|
||||
data: image.toDataURL(),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public getCurrentWindow = (window, e) => {
|
||||
@@ -323,8 +314,12 @@ class API {
|
||||
return true;
|
||||
}
|
||||
|
||||
public screenCapture() {
|
||||
screenshots.startCapture();
|
||||
public screenCapture(arg, window) {
|
||||
screenCapture(window, (img) => {
|
||||
runnerInstance.executeHooks('ScreenCapture', {
|
||||
data: img,
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user