diff --git a/docs/api/ipc-renderer.md b/docs/api/ipc-renderer.md index 70fee3d51a29..1238ee50c4f2 100644 --- a/docs/api/ipc-renderer.md +++ b/docs/api/ipc-renderer.md @@ -192,7 +192,7 @@ ipcMain.on('port', (e, msg) => { For more information on using `MessagePort` and `MessageChannel`, see the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel). -### `ipcRenderer.sendTo(webContentsId, channel, ...args)` +### `ipcRenderer.sendTo(webContentsId, channel, ...args)` _Deprecated_ * `webContentsId` number * `channel` string diff --git a/docs/api/structures/ipc-renderer-event.md b/docs/api/structures/ipc-renderer-event.md index cac7fff78ef2..0f9c16867441 100644 --- a/docs/api/structures/ipc-renderer-event.md +++ b/docs/api/structures/ipc-renderer-event.md @@ -4,5 +4,5 @@ * `senderId` Integer - The `webContents.id` that sent the message, you can call `event.sender.sendTo(event.senderId, ...)` to reply to the message, see [ipcRenderer.sendTo][ipc-renderer-sendto] for more information. This only applies to messages sent from a different renderer. Messages sent directly from the main process set `event.senderId` to `0`. * `ports` [MessagePort][][] - A list of MessagePorts that were transferred with this message -[ipc-renderer-sendto]: ../ipc-renderer.md#ipcrenderersendtowebcontentsid-channel-args +[ipc-renderer-sendto]: ../ipc-renderer.md#ipcrenderersendtowebcontentsid-channel-args-deprecated [MessagePort]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort diff --git a/docs/breaking-changes.md b/docs/breaking-changes.md index 88c66e8e1ad2..a0ed15a13acb 100644 --- a/docs/breaking-changes.md +++ b/docs/breaking-changes.md @@ -21,6 +21,10 @@ macOS 10.13 (High Sierra) and macOS 10.14 (Mojave) are no longer supported by [C Older versions of Electron will continue to run on these operating systems, but macOS 10.15 (Catalina) or later will be required to run Electron v27.0.0 and higher. +### Deprecated: `ipcRenderer.sendTo()` + +The `ipcRenderer.sendTo()` API has been deprecated. It should be replaced by setting up a [`MessageChannel`](tutorial/message-ports.md#setting-up-a-messagechannel-between-two-renderers) between the renderers. + ## Planned Breaking API Changes (25.0) ### Deprecated: `protocol.{register,intercept}{Buffer,String,Stream,File,Http}Protocol` diff --git a/filenames.auto.gni b/filenames.auto.gni index 2419131d326b..d675196e45dc 100644 --- a/filenames.auto.gni +++ b/filenames.auto.gni @@ -143,6 +143,7 @@ auto_filenames = { sandbox_bundle_deps = [ "lib/common/api/native-image.ts", "lib/common/define-properties.ts", + "lib/common/deprecate.ts", "lib/common/ipc-messages.ts", "lib/common/web-view-methods.ts", "lib/common/webpack-globals-provider.ts", @@ -268,6 +269,7 @@ auto_filenames = { "lib/common/api/native-image.ts", "lib/common/api/shell.ts", "lib/common/define-properties.ts", + "lib/common/deprecate.ts", "lib/common/init.ts", "lib/common/ipc-messages.ts", "lib/common/reset-search-paths.ts", @@ -306,6 +308,7 @@ auto_filenames = { "lib/common/api/native-image.ts", "lib/common/api/shell.ts", "lib/common/define-properties.ts", + "lib/common/deprecate.ts", "lib/common/init.ts", "lib/common/ipc-messages.ts", "lib/common/reset-search-paths.ts", diff --git a/lib/renderer/api/ipc-renderer.ts b/lib/renderer/api/ipc-renderer.ts index 3ba7604cbe68..4e1e7fba21c8 100644 --- a/lib/renderer/api/ipc-renderer.ts +++ b/lib/renderer/api/ipc-renderer.ts @@ -1,4 +1,5 @@ import { EventEmitter } from 'events'; +import * as deprecate from '@electron/internal/common/deprecate'; const { ipc } = process._linkedBinding('electron_renderer_ipc'); @@ -18,6 +19,7 @@ ipcRenderer.sendToHost = function (channel, ...args) { }; ipcRenderer.sendTo = function (webContentsId, channel, ...args) { + deprecate.warnOnce('ipcRenderer.sendTo'); return ipc.sendTo(webContentsId, channel, args); };