first commit
This commit is contained in:
12
apps/electron/preload.mjs
Normal file
12
apps/electron/preload.mjs
Normal file
@@ -0,0 +1,12 @@
|
||||
import { contextBridge, ipcRenderer } from 'electron'
|
||||
|
||||
function listener(channel, callback) {
|
||||
const handler = () => callback()
|
||||
ipcRenderer.on(channel, handler)
|
||||
return () => ipcRenderer.removeListener(channel, handler)
|
||||
}
|
||||
|
||||
contextBridge.exposeInMainWorld('nativeVueHost', {
|
||||
onBack: (callback) => listener('native-vue:back', callback),
|
||||
onForward: (callback) => listener('native-vue:forward', callback),
|
||||
})
|
||||
Reference in New Issue
Block a user