Skip to content

The renderer's node-ipc works in the {contextIsolation: true} ? #11

@zicjin

Description

@zicjin

Electron 12 it will be enabled contextIsolation by default.
https://www.electronjs.org/docs/tutorial/context-isolation

contextBridge.exposeInMainWorld('electron', {
  getSocketId: () => socketPromise,
  ipcConnect: (id, func) => {
    ipc.config.silent = true
    ipc.connectTo(id, () => {
      func(ipc.of[id])
    })
  },
  ...
})

got error:
image

const connectSocket = (socketId: string) => {
  window.electron.ipcConnect(socketId, (client) => {
    client.on('message', (data: string) => {
      const msg = JSON.parse(data)
  ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions