docs: mention contextIsolation in ipc-main example (#29918)
This commit is contained in:
		
					parent
					
						
							
								257b796856
							
						
					
				
			
			
				commit
				
					
						550d3c11a8
					
				
			
		
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -40,6 +40,8 @@ ipcMain.on('synchronous-message', (event, arg) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```javascript
 | 
					```javascript
 | 
				
			||||||
// In renderer process (web page).
 | 
					// 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')
 | 
					const { ipcRenderer } = require('electron')
 | 
				
			||||||
console.log(ipcRenderer.sendSync('synchronous-message', 'ping')) // prints "pong"
 | 
					console.log(ipcRenderer.sendSync('synchronous-message', 'ping')) // prints "pong"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue