2
所以我在main文件main.js中創建了一個函數BrowserWindow。可以說:是否有可能在main.js文件中從web到電子調用函數?
function HelloWorld(name){
return 'Hello World! said ' + name;
}
我可以在由Electron加載的html頁面中調用嗎?
<html>
<head>
<script type="text/javascript">
const hello = require('electron').HelloWorld
</script>
</head>
<body onLoad="alert(hello);">
</body>
</html>
我可以這樣做嗎?
爲什麼不寫一個單獨的模塊,然後在兩個地方加載它? –
而不是返回HelloWorld。我想創建一個Socket.IO服務器。 @MikeC – Facundo
uhmm,你可以做類似的事情,使用ipcMain和ipcRenderer –