Whalebird-desktop-client-ma.../renderer/utils/invoke.tsx

17 lines
442 B
TypeScript
Raw Normal View History

2024-09-23 12:19:16 +02:00
export function invoke(event: string, data: any): Promise<any> {
2024-03-08 13:05:59 +01:00
if (process.env.NEXT_PUBLIC_CLIENT_ENV !== 'browser') {
2024-09-23 12:19:16 +02:00
return global.ipc.invoke(event, data)
2024-03-08 13:05:59 +01:00
}
switch (event) {
case 'open-browser':
window.open(data, '_blank').focus()
return
2024-09-09 18:43:49 +02:00
case 'set-proxy':
console.warn('Can not use proxy in this environment')
return
2024-03-08 13:05:59 +01:00
default:
console.error(`Unknown event: ${event}`)
return
}
}