refactor: use function instead of static methods
This commit is contained in:
1 parent
df48a423af
commit
f7bfd76e5e
1 file changed
+8
-12
@@ -1,15 +1,11 @@
|
||||
export default class Utils {
|
||||
static getCurrentLocale(): string {
|
||||
export function getCurrentLocale(): string {
|
||||
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