forked from imodeljs/imodeljs-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
31 lines (31 loc) · 1.27 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
import * as path from "path";
import { RpcInterfaceDefinition, ElectronRpcManager } from "@bentley/imodeljs-common";
import { IModelJsElectronManager } from "@bentley/electron-manager";
/**
* Initializes Electron backend
*/
export default function initialize(rpcs: RpcInterfaceDefinition[]) {
(async () => { // tslint:disable-line:no-floating-promises
const manager = new IModelJsElectronManager(path.join(__dirname, "..", "..", "webresources"));
await manager.initialize({
width: 1280,
height: 800,
webPreferences: {
experimentalFeatures: true, // Needed for CSS Grid support
nodeIntegration: true,
preload: path.join(__dirname, "preload.js"),
},
autoHideMenuBar: true,
show: false,
});
// tell ElectronRpcManager which RPC interfaces to handle
ElectronRpcManager.initializeImpl({}, rpcs);
if (manager.mainWindow) {
manager.mainWindow.show();
}
})();
}