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)
|
||||
@@ -1,4 +1,4 @@
|
||||
<script setup>
|
||||
<script setup lang="tsx">
|
||||
import { DefaultLayout } from '@/renderer/components/layout'
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import HeaderLayout from '@/renderer/components/layout/HeaderLayout'
|
||||
<script setup lang="tsx">
|
||||
import HeaderLayout from '@/renderer/components/layout/HeaderLayout.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
File renamed without changes.
@@ -6,5 +6,5 @@
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script type="module" src="./main.js"></script>
|
||||
<script type="module" src="./main.ts"></script>
|
||||
</html>
|
||||
@@ -1,7 +1,7 @@
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
import App from '@/renderer/App'
|
||||
import App from '@/renderer/App.vue'
|
||||
import router from '@/renderer/router'
|
||||
import vuetify from '@/renderer/plugins/vuetify'
|
||||
import i18n from '@/renderer/plugins/i18n'
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,4 +1,4 @@
|
||||
<script setup>
|
||||
<script setup lang="tsx">
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<script setup>
|
||||
<script setup lang="tsx">
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useTheme } from 'vuetify'
|
||||
import Utils from '@/renderer/utils'
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,11 +1,11 @@
|
||||
import { shell } from 'electron'
|
||||
|
||||
export default class Utils {
|
||||
static getCurrentLocale () {
|
||||
static getCurrentLocale () : string {
|
||||
return navigator?.language?.split('-')[0] || 'en'
|
||||
}
|
||||
|
||||
static async openExternal (url) {
|
||||
static async openExternal (url: string) : Promise<void> {
|
||||
await shell.openExternal(url)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user