pack: vutron now uses typescript
This commit is contained in:
1 parent
30b0676f13
commit
5a4fa9a981
25 files changed
+580
-26
No files matched your search
@@ -1,16 +1,16 @@
|
||||
import { app, BrowserWindow } from 'electron'
|
||||
import { app, BrowserWindow, RenderProcessGoneDetails } from 'electron'
|
||||
import Constants from './utils/Constants'
|
||||
import * as electronRemote from '@electron/remote/main'
|
||||
|
||||
const exitApp = (mainWindow) => {
|
||||
const exitApp = (mainWindow: BrowserWindow) : void => {
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
mainWindow.hide()
|
||||
}
|
||||
mainWindow = null
|
||||
mainWindow.destroy()
|
||||
app.exit()
|
||||
}
|
||||
|
||||
export const createMainWindow = async (mainWindow) => {
|
||||
export const createMainWindow = async (mainWindow: BrowserWindow) : Promise<BrowserWindow> => {
|
||||
mainWindow = new BrowserWindow({
|
||||
title: Constants.APP_NAME,
|
||||
show: false,
|
||||
@@ -22,7 +22,7 @@ export const createMainWindow = async (mainWindow) => {
|
||||
|
||||
mainWindow.setMenu(null)
|
||||
|
||||
mainWindow.on('close', (event) => {
|
||||
mainWindow.on('close', (event: Event) => {
|
||||
event.preventDefault()
|
||||
exitApp(mainWindow)
|
||||
})
|
||||
@@ -51,7 +51,7 @@ export const createMainWindow = async (mainWindow) => {
|
||||
return mainWindow
|
||||
}
|
||||
|
||||
export const createErrorWindow = async (errorWindow, mainWindow, details) => {
|
||||
export const createErrorWindow = async (errorWindow: BrowserWindow, mainWindow: BrowserWindow, details?: RenderProcessGoneDetails) : Promise<BrowserWindow> => {
|
||||
if (!Constants.IS_DEV_ENV) {
|
||||
mainWindow?.hide()
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { app } from 'electron'
|
||||
import { app, WebContents, RenderProcessGoneDetails } from 'electron'
|
||||
import Constants from './utils/Constants'
|
||||
import { createErrorWindow, createMainWindow } from './MainRunner'
|
||||
import Menus from './utils/Menus'
|
||||
@@ -27,7 +27,7 @@ app.on('window-all-closed', () => {
|
||||
}
|
||||
})
|
||||
|
||||
app.on('render-process-gone', (ev, webContents, details) => {
|
||||
app.on('render-process-gone', (event: Event, webContents: WebContents, details: RenderProcessGoneDetails) => {
|
||||
errorWindow = createErrorWindow(errorWindow, mainWindow, details)
|
||||
})
|
||||
|
||||
File renamed without changes.
@@ -2,7 +2,7 @@ import { systemPreferences } from 'electron'
|
||||
import Constants from './Constants'
|
||||
|
||||
export default class Menus {
|
||||
static macOSDisableDefaultMenuItem () {
|
||||
static macOSDisableDefaultMenuItem () : void {
|
||||
if (Constants.IS_MAC) {
|
||||
systemPreferences.setUserDefault('NSDisabledDictationMenuItem', 'boolean', true)
|
||||
systemPreferences.setUserDefault('NSDisabledCharacterPaletteMenuItem', 'boolean', true)
|
||||
Reference in new issue
Block a user