зеркало из https://github.com/Azure/BatchExplorer.git
Родитель
3bb271641c
Коммит
82b3e71ba5
|
@ -1,5 +1,12 @@
|
||||||
import { Injectable } from "@angular/core";
|
import { Injectable } from "@angular/core";
|
||||||
import { IpcService } from "./ipc.service";
|
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
|
// Uncomment bellow to check sendSync performance issues
|
||||||
// let total = 0;
|
// let total = 0;
|
||||||
|
@ -13,18 +20,24 @@ import { IpcService } from "./ipc.service";
|
||||||
// return result;
|
// return result;
|
||||||
// };
|
// };
|
||||||
|
|
||||||
|
type ElectronRemoteModule = {
|
||||||
|
Menu: typeof RemoteMenu,
|
||||||
|
MenuItem: typeof RemoteMenuItem,
|
||||||
|
dialog: typeof RemoteDialog,
|
||||||
|
app: typeof RemoteApp,
|
||||||
|
getCurrentWindow: typeof remoteGetCurrentWindow
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injectable service wrapping electron shell.
|
* Injectable service wrapping electron shell.
|
||||||
* This makes it easier to mock the electron shell.
|
* This makes it easier to mock the electron shell.
|
||||||
*/
|
*/
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ElectronRemote {
|
export class ElectronRemote {
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention,no-underscore-dangle,id-blacklist,id-match
|
|
||||||
public Menu: typeof Electron.Menu;
|
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;
|
public MenuItem: typeof Electron.MenuItem;
|
||||||
|
|
||||||
private _remote;
|
private _remote: ElectronRemoteModule;
|
||||||
|
|
||||||
constructor(private ipc: IpcService) {
|
constructor(private ipc: IpcService) {
|
||||||
// Require here because importing @electron/remote fails for client
|
// 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
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
this._remote = require("@electron/remote");
|
this._remote = require("@electron/remote");
|
||||||
|
|
||||||
this.Menu = this._remote.RemoteMenu;
|
this.Menu = this._remote.Menu;
|
||||||
this.MenuItem = this._remote.MenuItem;
|
this.MenuItem = this._remote.MenuItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче