mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 02:36:04 +10:00
Initial commit
moved from private version control
This commit is contained in:
22
preload.js
Normal file
22
preload.js
Normal file
@@ -0,0 +1,22 @@
|
||||
const { contextBridge, ipcRenderer } = require("electron");
|
||||
|
||||
/**
|
||||
* Provides renderer processes with limited access to Electron IPC bridges.
|
||||
*/
|
||||
const api = {
|
||||
/**
|
||||
* Requests that the main process compile the supplied Lua source to disk.
|
||||
*
|
||||
* @param {string} source Lua program text emitted from the workspace.
|
||||
* @returns {Promise<{ filePath: string }>}
|
||||
*/
|
||||
compileLua(source) {
|
||||
if (typeof source !== "string") {
|
||||
return Promise.reject(new TypeError("Lua source must be a string"));
|
||||
}
|
||||
|
||||
return ipcRenderer.invoke("lua:compile", source);
|
||||
},
|
||||
};
|
||||
|
||||
contextBridge.exposeInMainWorld("electronAPI", api);
|
||||
Reference in New Issue
Block a user