This commit is contained in:
2021-04-07 12:28:05 +02:00
parent 46704211fa
commit 72ee5d7641
9 changed files with 26 additions and 13 deletions

View File

@@ -30,7 +30,7 @@ export default class TrayUtility {
static setStatus(status: string) {
this.menu[0].label = status
this.tray.setContextMenu(this.build())
this.tray?.setContextMenu(this.build())
}
private static build() {

View File

@@ -20,8 +20,9 @@ export default class Updater {
url,
})
// parse tags and reverse sort them to get the highest
const tags = data.map((d) => semver.coerce(d.name)).sort(semver.rcompare)
const tags = data.map((d: any) => semver.coerce(d.name)).sort(semver.rcompare)
const latest = tags[0]
if (!current) throw new Error('Could not determine current version')
if (semver.lt(current, latest)) {
logger.info('New version available')
dialog

View File

@@ -7,15 +7,17 @@ import { render } from 'react-dom'
// @ts-ignore
import chime from 'url:../assets/chime.mp3'
const useKeyPress = (handler) => {
const handlerRef = useRef<(e: KeyboardEvent) => void>()
const useKeyPress = (handler: (e: KeyboardEvent) => void) => {
const handlerRef = useRef<typeof handler>()
useEffect(() => {
handlerRef.current = handler
}, [handler])
useEffect(() => {
const fn = (event) => handlerRef.current(event)
const fn = (event: KeyboardEvent) => {
if (handlerRef.current) handlerRef.current(event)
}
window.addEventListener('keydown', fn)
return () => {
window.removeEventListener('keydown', fn)

View File

@@ -1,4 +1,3 @@
/* @import 'hiq/dist/hiq.css'; */
@import 'spectre.css/dist/spectre.min.css';
@import 'tachyons/css/tachyons.min.css';

View File

@@ -1,4 +1,4 @@
import React, { useCallback } from 'react'
import React from 'react'
import Link from './ExternalLink'