13 lines
303 B
TypeScript
13 lines
303 B
TypeScript
import { contextBridge, ipcRenderer } from 'electron';
|
|
|
|
const API_HANDLERS = [
|
|
"vnscene:test"
|
|
];
|
|
|
|
contextBridge.exposeInMainWorld(
|
|
'dawnapi',
|
|
API_HANDLERS.reduce((acc, key) => {
|
|
acc[key] = (...args:any) => ipcRenderer.invoke(key, ...args);
|
|
return acc;
|
|
}, {} as {[key:string]:()=>any})
|
|
); |