electron 11 cleanup

This commit is contained in:
Eugene Pankov
2020-12-24 14:03:14 +01:00
parent e87f6e7af0
commit 0ca971a289
87 changed files with 9169 additions and 8285 deletions

View File

@@ -5,7 +5,7 @@ if (process.platform === 'win32' || process.platform === 'linux') {
import { Subject, Observable } from 'rxjs'
import { debounceTime } from 'rxjs/operators'
import { BrowserWindow, app, ipcMain, Rectangle, Menu, screen } from 'electron'
import { BrowserWindow, app, ipcMain, Rectangle, Menu, screen, BrowserWindowConstructorOptions } from 'electron'
import ElectronConfig = require('electron-config')
import * as os from 'os'
import * as path from 'path'
@@ -13,7 +13,7 @@ import * as path from 'path'
import { parseArgs } from './cli'
import { loadConfig } from './config'
let DwmEnableBlurBehindWindow: any
let DwmEnableBlurBehindWindow: any = null
if (process.platform === 'win32') {
DwmEnableBlurBehindWindow = require('windows-blurbehind').DwmEnableBlurBehindWindow
}
@@ -45,13 +45,13 @@ export class Window {
this.windowConfig = new ElectronConfig({ name: 'window' })
this.windowBounds = this.windowConfig.get('windowBoundaries')
let maximized = this.windowConfig.get('maximized')
let bwOptions: Electron.BrowserWindowConstructorOptions = {
const maximized = this.windowConfig.get('maximized')
const bwOptions: BrowserWindowConstructorOptions = {
width: 800,
height: 600,
title: 'Terminus',
minWidth: 400,
minHeight: 300,
minHeight: 300,
webPreferences: {
nodeIntegration: true,
preload: path.join(__dirname, 'sentry.js'),
@@ -139,7 +139,7 @@ export class Window {
} else {
DwmEnableBlurBehindWindow(this.window, enabled)
}
} else if (process.platform ==='linux') {
} else if (process.platform === 'linux') {
glasstron.update(this.window, {
linux: { requestBlur: enabled },
})
@@ -158,7 +158,7 @@ export class Window {
this.window.focus()
}
send (event: string, ...args): void {
send (event: string, ...args: any[]): void {
if (!this.window) {
return
}
@@ -225,7 +225,7 @@ export class Window {
this.visible.next(false)
})
let moveSubscription = new Observable<void>(observer => {
const moveSubscription = new Observable<void>(observer => {
this.window.on('move', () => observer.next())
}).pipe(debounceTime(250)).subscribe(() => {
this.send('host:window-moved')