diff --git a/desktop/src/@batch-flask/electron/remote.service.ts b/desktop/src/@batch-flask/electron/remote.service.ts index 4810f641e..a974d5080 100644 --- a/desktop/src/@batch-flask/electron/remote.service.ts +++ b/desktop/src/@batch-flask/electron/remote.service.ts @@ -1,5 +1,12 @@ import { Injectable } from "@angular/core"; import { IpcService } from "./ipc.service"; +import type { + Menu as RemoteMenu, + MenuItem as RemoteMenuItem, + dialog as RemoteDialog, + app as RemoteApp, + getCurrentWindow as remoteGetCurrentWindow +} from "@electron/remote"; // Uncomment bellow to check sendSync performance issues // let total = 0; @@ -13,18 +20,24 @@ import { IpcService } from "./ipc.service"; // return result; // }; +type ElectronRemoteModule = { + Menu: typeof RemoteMenu, + MenuItem: typeof RemoteMenuItem, + dialog: typeof RemoteDialog, + app: typeof RemoteApp, + getCurrentWindow: typeof remoteGetCurrentWindow +} + /** * Injectable service wrapping electron shell. * This makes it easier to mock the electron shell. */ @Injectable() export class ElectronRemote { - // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match public Menu: typeof Electron.Menu; - // eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match public MenuItem: typeof Electron.MenuItem; - private _remote; + private _remote: ElectronRemoteModule; constructor(private ipc: IpcService) { // Require here because importing @electron/remote fails for client @@ -32,7 +45,7 @@ export class ElectronRemote { // eslint-disable-next-line @typescript-eslint/no-var-requires this._remote = require("@electron/remote"); - this.Menu = this._remote.RemoteMenu; + this.Menu = this._remote.Menu; this.MenuItem = this._remote.MenuItem; }