📝 Update API documentation to ES6 [ci skip]
This commit is contained in:
parent
178496afe5
commit
5a9f28e034
28 changed files with 168 additions and 176 deletions
|
@ -23,13 +23,13 @@ processes:
|
|||
|
||||
```javascript
|
||||
// In main process.
|
||||
const ipcMain = require('electron').ipcMain;
|
||||
ipcMain.on('asynchronous-message', function(event, arg) {
|
||||
const { ipcMain } = require('electron');
|
||||
ipcMain.on('asynchronous-message', (event, arg) => {
|
||||
console.log(arg); // prints "ping"
|
||||
event.sender.send('asynchronous-reply', 'pong');
|
||||
});
|
||||
|
||||
ipcMain.on('synchronous-message', function(event, arg) {
|
||||
ipcMain.on('synchronous-message', (event, arg) => {
|
||||
console.log(arg); // prints "ping"
|
||||
event.returnValue = 'pong';
|
||||
});
|
||||
|
@ -37,10 +37,10 @@ ipcMain.on('synchronous-message', function(event, arg) {
|
|||
|
||||
```javascript
|
||||
// In renderer process (web page).
|
||||
const ipcRenderer = require('electron').ipcRenderer;
|
||||
const { ipcRenderer } = require('electron');
|
||||
console.log(ipcRenderer.sendSync('synchronous-message', 'ping')); // prints "pong"
|
||||
|
||||
ipcRenderer.on('asynchronous-reply', function(event, arg) {
|
||||
ipcRenderer.on('asynchronous-reply', (event, arg) => {
|
||||
console.log(arg); // prints "pong"
|
||||
});
|
||||
ipcRenderer.send('asynchronous-message', 'ping');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue