在 html 中调用 electron 的函数 主进程的函数 nodejs
时间:2020-10-24 11:52:29
收藏:0
阅读:74
html是在renderer进程。如果要调用主进程需要用remote
<input type="button" value="cache" onclick="getCache()"> <script> const { remote, ipcRenderer, shell } = require(‘electron‘); const win = remote.getCurrentWindow(); var getCache=()=>{ var size = win.webContents.session.getCacheSize(); }
const mainProcess = remote.require(‘./main.js‘); </script>
electron In action 示例很好:
https://github.com/electron-in-action
评论(0)