more electron/web separation

This commit is contained in:
Eugene Pankov
2021-06-19 01:36:25 +02:00
parent fa31ac65ab
commit fad7858f3f
50 changed files with 568 additions and 448 deletions

View File

@@ -9,6 +9,7 @@ import * as path from 'path'
import macOSRelease from 'macos-release'
import * as compareVersions from 'compare-versions'
import type { Application } from './app'
import { parseArgs } from './cli'
import { loadConfig } from './config'
@@ -43,7 +44,7 @@ export class Window {
get visible$ (): Observable<boolean> { return this.visible }
get closed$ (): Observable<void> { return this.closed }
constructor (options?: WindowOptions) {
constructor (private application: Application, options?: WindowOptions) {
this.configStore = loadConfig()
options = options ?? {}
@@ -299,16 +300,10 @@ export class Window {
executable: app.getPath('exe'),
windowID: this.window.id,
isFirstWindow: this.window.id === 1,
userPluginsPath: this.application.userPluginsPath,
})
})
ipcMain.on('window-focus', event => {
if (!this.window || event.sender !== this.window.webContents) {
return
}
this.window.focus()
})
ipcMain.on('window-toggle-maximize', event => {
if (!this.window || event.sender !== this.window.webContents) {
return