This commit is contained in:
Eugene Pankov
2020-03-01 16:10:45 +01:00
parent fda4d2dcef
commit 04a0a0cc64
81 changed files with 284 additions and 295 deletions

View File

@@ -31,7 +31,7 @@ export class Application {
}
}
init () {
init (): void {
electron.screen.on('display-metrics-changed', () => this.broadcast('host:display-metrics-changed'))
}
@@ -52,20 +52,20 @@ export class Application {
return window
}
broadcast (event, ...args) {
for (let window of this.windows) {
broadcast (event: string, ...args): void {
for (const window of this.windows) {
window.send(event, ...args)
}
}
async send (event, ...args) {
async send (event: string, ...args): void {
if (!this.hasWindows()) {
await this.newWindow()
}
this.windows.filter(w => !w.isDestroyed())[0].send(event, ...args)
}
enableTray () {
enableTray (): void {
if (this.tray) {
return
}
@@ -90,18 +90,18 @@ export class Application {
this.tray.setToolTip(`Terminus ${app.getVersion()}`)
}
disableTray () {
disableTray (): void {
if (this.tray) {
this.tray.destroy()
this.tray = null
}
}
hasWindows () {
hasWindows (): bool {
return !!this.windows.length
}
focus () {
focus (): void {
for (let window of this.windows) {
window.show()
}

View File

@@ -1,6 +1,6 @@
import { app } from 'electron'
export function parseArgs (argv, cwd) {
export function parseArgs (argv: string[], cwd: string): any {
if (argv[0].includes('node')) {
argv = argv.slice(1)
}

View File

@@ -119,7 +119,7 @@ export class Window {
})
}
setVibrancy (enabled: boolean, type?: string) {
setVibrancy (enabled: boolean, type?: string): void {
this.lastVibrancy = { enabled, type }
if (process.platform === 'win32') {
if (parseFloat(os.release()) >= 10) {
@@ -140,22 +140,22 @@ export class Window {
}
}
show () {
show (): void {
this.window.show()
}
focus () {
focus (): void {
this.window.focus()
}
send (event, ...args) {
send (event: string, ...args): void {
if (!this.window) {
return
}
this.window.webContents.send(event, ...args)
}
isDestroyed () {
isDestroyed (): void {
return !this.window || this.window.isDestroyed()
}

View File

@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { NgbModule } from '@ng-bootstrap/ng-bootstrap'