Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zicjin opened this issue Feb 27, 2021 · 0 comments
Open

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

zicjin opened this issue Feb 27, 2021 · 0 comments

Comments

@zicjin
Copy link

zicjin commented Feb 27, 2021

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)
  ...
@zicjin zicjin changed the title Can node-ipc communication be achieved through contextIsolation? The renderer's node-ipc works in the {contextIsolation: true} ? Feb 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant