From b27401172033e7c8fac38d3b2d784fe8f9a481b2 Mon Sep 17 00:00:00 2001 From: Abhay Gupta <51379307+akgupta0777@users.noreply.github.com> Date: Wed, 16 Mar 2022 08:01:29 -0700 Subject: [PATCH] fix: fiddle ipc code pattern 3 (#33262) --- docs/fiddles/ipc/pattern-3/renderer.js | 2 +- docs/tutorial/ipc.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/fiddles/ipc/pattern-3/renderer.js b/docs/fiddles/ipc/pattern-3/renderer.js index 3b184add08ba..04fd4bca890a 100644 --- a/docs/fiddles/ipc/pattern-3/renderer.js +++ b/docs/fiddles/ipc/pattern-3/renderer.js @@ -4,5 +4,5 @@ window.electronAPI.handleCounter((event, value) => { const oldValue = Number(counter.innerText) const newValue = oldValue + value counter.innerText = newValue - event.reply('counter-value', newValue) + event.sender.send('counter-value', newValue) }) diff --git a/docs/tutorial/ipc.md b/docs/tutorial/ipc.md index 0189e0db7e80..5d3fc2ffec29 100644 --- a/docs/tutorial/ipc.md +++ b/docs/tutorial/ipc.md @@ -379,7 +379,7 @@ module that uses the `webContents.send` API to send an IPC message from the main target renderer. ```javascript {11-26} title='main.js (Main Process)' -const {app, BrowserWindow, Menu} = require('electron') +const {app, BrowserWindow, Menu, ipcMain} = require('electron') const path = require('path') function createWindow () { @@ -519,7 +519,7 @@ window.electronAPI.onUpdateCounter((event, value) => { const oldValue = Number(counter.innerText) const newValue = oldValue + value counter.innerText = newValue - event.reply('counter-value', newValue) + event.sender.send('counter-value', newValue) }) ```