mirror of
https://github.com/mehotkhan/BandersnatchInteractive.git
synced 2025-07-29 10:09:54 +00:00
Init Electrin-Vite
This commit is contained in:
parent
a4483fcb48
commit
73dc8bd1d6
32 changed files with 238 additions and 0 deletions
22
src/preload/index.ts
Normal file
22
src/preload/index.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { contextBridge } from 'electron'
|
||||
import { electronAPI } from '@electron-toolkit/preload'
|
||||
|
||||
// Custom APIs for renderer
|
||||
const api = {}
|
||||
|
||||
// Use `contextBridge` APIs to expose Electron APIs to
|
||||
// renderer only if context isolation is enabled, otherwise
|
||||
// just add to the DOM global.
|
||||
if (process.contextIsolated) {
|
||||
try {
|
||||
contextBridge.exposeInMainWorld('electron', electronAPI)
|
||||
contextBridge.exposeInMainWorld('api', api)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
} else {
|
||||
// @ts-ignore (define in dts)
|
||||
window.electron = electronAPI
|
||||
// @ts-ignore (define in dts)
|
||||
window.api = api
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue