(
routeName: RouteActionType,
param: MinimalParam,
main: boolean,
queryString: string = ""
)
| 275 | } |
| 276 | |
| 277 | createWindow( |
| 278 | routeName: RouteActionType, |
| 279 | param: MinimalParam, |
| 280 | main: boolean, |
| 281 | queryString: string = "" |
| 282 | ): BrowserWindow { |
| 283 | const cfg = { |
| 284 | ...defaultConfig, |
| 285 | ...param, |
| 286 | alwaysOnTop: config.get<boolean>("stayTop"), |
| 287 | }; |
| 288 | const window = new BrowserWindow(cfg); |
| 289 | |
| 290 | if (!cfg.show) { |
| 291 | window.once("ready-to-show", () => { |
| 292 | window.show(); |
| 293 | }); |
| 294 | } |
| 295 | loadRoute(window, routeName, true, queryString); |
| 296 | insertStyles(window); |
| 297 | if (main) { |
| 298 | this.started = false; |
| 299 | window.on("close", (e: any) => { |
| 300 | const closeAsQuit = this.controller.get("closeAsQuit"); |
| 301 | if (!closeAsQuit) { |
| 302 | e.preventDefault(); |
| 303 | window.hide(); |
| 304 | } |
| 305 | }); |
| 306 | window.webContents.once("did-finish-load", (e: any) => { |
| 307 | this.started = true; |
| 308 | for (const func of this.postStartCallbacks) { |
| 309 | func(); |
| 310 | } |
| 311 | }); |
| 312 | } |
| 313 | window.on("closed", () => { |
| 314 | this.windows.delete(routeName); |
| 315 | }); |
| 316 | this.windows.set(routeName, window); |
| 317 | return window; |
| 318 | } |
| 319 | |
| 320 | createMain() { |
| 321 | let window_config = { |
no test coverage detected