docs: mention contextIsolation in ipc-main example (#29918)

This commit is contained in:
Jeremy Rose
2021-07-06 10:27:35 -07:00
committed by GitHub
parent 257b796856
commit 550d3c11a8

View File

@@ -40,6 +40,8 @@ ipcMain.on('synchronous-message', (event, arg) => {
```javascript
// In renderer process (web page).
// NB. Electron APIs are only accessible from preload, unless contextIsolation is disabled.
// See https://www.electronjs.org/docs/tutorial/process-model#preload-scripts for more details.
const { ipcRenderer } = require('electron')
console.log(ipcRenderer.sendSync('synchronous-message', 'ping')) // prints "pong"