You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
638 B
18 lines
638 B
"use strict";
|
|
|
|
const {contextBridge, ipcRenderer} = require("electron");
|
|
|
|
let fileOpenListener = null;
|
|
|
|
contextBridge.exposeInMainWorld("api", {
|
|
openFileDialog : () => ipcRenderer.send("WindowManager::openFileDialog"),
|
|
onFileOpen : callback => {
|
|
if (fileOpenListener)
|
|
ipcRenderer.off("Ation::openFile", fileOpenListener);
|
|
fileOpenListener = (_, presentation) => callback(presentation);
|
|
ipcRenderer.on("Ation::openFile", fileOpenListener);
|
|
},
|
|
openFile : filePath => ipcRenderer.send("WindowManager::openFile", filePath),
|
|
|
|
removeOnFileOpenListener : callback => ipcRenderer.off("Ation::openFile", callback)
|
|
}); |