支持系统插件

This commit is contained in:
muwoo
2021-12-08 20:01:25 +08:00
parent 8a35e60e48
commit 64f2eba2fa
3 changed files with 65 additions and 1 deletions

View File

@@ -1,5 +1,10 @@
"use strict";
import { app, globalShortcut, protocol, BrowserWindow } from "electron";
import electron, {
app,
globalShortcut,
protocol,
BrowserWindow,
} from "electron";
import { main } from "./browsers";
import commonConst from "../common/utils/commonConst";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -11,8 +16,11 @@ import registerHotKey from "./common/registerHotKey";
import "../common/utils/localPlugin";
import "../common/utils/localConfig";
import registerySystemPlugin from "./common/registerySystemPlugin";
class App {
private windowCreator: { init: () => void; getWindow: () => BrowserWindow };
private systemPlugins: any;
constructor() {
protocol.registerSchemesAsPrivileged([
@@ -23,6 +31,7 @@ class App {
if (!gotTheLock) {
app.quit();
} else {
this.systemPlugins = registerySystemPlugin();
this.beforeReady();
this.onReady();
this.onRunning();
@@ -54,6 +63,9 @@ class App {
// this.init()
createTray(this.windowCreator.getWindow());
registerHotKey(this.windowCreator.getWindow());
this.systemPlugins.triggerReadyHooks(
Object.assign(electron, { mainWindow: this.windowCreator.getWindow() })
);
};
if (!app.isReady()) {
app.on("ready", readyFunction);