|
|
@ -3,6 +3,7 @@ |
|
|
|
const {contextBridge, ipcRenderer, webFrame} = require("electron"); |
|
|
|
const {contextBridge, ipcRenderer, webFrame} = require("electron"); |
|
|
|
|
|
|
|
|
|
|
|
let fileOpenListener = null; |
|
|
|
let fileOpenListener = null; |
|
|
|
|
|
|
|
let closeFileListener = null; |
|
|
|
|
|
|
|
|
|
|
|
contextBridge.exposeInMainWorld("api", { |
|
|
|
contextBridge.exposeInMainWorld("api", { |
|
|
|
openFileDialog : () => ipcRenderer.send("WindowManager::openFileDialog"), |
|
|
|
openFileDialog : () => ipcRenderer.send("WindowManager::openFileDialog"), |
|
|
@ -12,9 +13,14 @@ contextBridge.exposeInMainWorld("api", { |
|
|
|
fileOpenListener = (_, presentation) => callback(presentation); |
|
|
|
fileOpenListener = (_, presentation) => callback(presentation); |
|
|
|
ipcRenderer.on("Ation::openFile", fileOpenListener); |
|
|
|
ipcRenderer.on("Ation::openFile", fileOpenListener); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
onFileClose : callback => { |
|
|
|
|
|
|
|
if (closeFileListener) |
|
|
|
|
|
|
|
ipcRenderer.off("Ation::closeFile", closeFileListener); |
|
|
|
|
|
|
|
closeFileListener = () => callback(); |
|
|
|
|
|
|
|
ipcRenderer.on("Ation::closeFile", closeFileListener); |
|
|
|
|
|
|
|
}, |
|
|
|
openFile : filePath => ipcRenderer.send("WindowManager::openFile", filePath), |
|
|
|
openFile : filePath => ipcRenderer.send("WindowManager::openFile", filePath), |
|
|
|
|
|
|
|
closeFile : () => ipcRenderer.send("Ation::closeFile"), |
|
|
|
removeOnFileOpenListener : callback => ipcRenderer.off("Ation::openFile", callback), |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
clearCache : () => webFrame.clearCache(), |
|
|
|
clearCache : () => webFrame.clearCache(), |
|
|
|
appVersion : async () => await ipcRenderer.invoke("Ation::appVersion") |
|
|
|
appVersion : async () => await ipcRenderer.invoke("Ation::appVersion") |
|
|
|