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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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"