refactor: use function instead of static methods
This commit is contained in:
1 parent
df48a423af
commit
f7bfd76e5e
1 file changed
+9
-13
@@ -1,15 +1,11 @@
|
|||||||
export default class Utils {
|
export function getCurrentLocale(): string {
|
||||||
static getCurrentLocale(): string {
|
return navigator?.language?.split('-')[0] || 'en'
|
||||||
return navigator?.language?.split('-')[0] || 'en'
|
|
||||||
}
|
|
||||||
|
|
||||||
static async openExternal(url: string): Promise<void> {
|
|
||||||
await window.mainApi.send('msgOpenExternalLink', url)
|
|
||||||
}
|
|
||||||
|
|
||||||
static async openFile(type: string): Promise<any> {
|
|
||||||
return window.mainApi.invoke('msgOpenFile', type)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const { getCurrentLocale, openExternal, openFile } = Utils
|
export async function openExternal(url: string): Promise<void> {
|
||||||
|
await window.mainApi.send('msgOpenExternalLink', url)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function openFile(type: string): Promise<any> {
|
||||||
|
return window.mainApi.invoke('msgOpenFile', type)
|
||||||
|
}
|
||||||
Reference in new issue
Block a user