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

No IPC events being shown; IPC chrome tools crashing #110

Open
appjitsu opened this issue Jun 26, 2018 · 0 comments
Open

No IPC events being shown; IPC chrome tools crashing #110

appjitsu opened this issue Jun 26, 2018 · 0 comments

Comments

@appjitsu
Copy link

appjitsu commented Jun 26, 2018

"electron": "^2.0.3",

console errors:

[5968:0626/095527.874:ERROR:CONSOLE(4799)] "Cannot find context with specified id", source: chrome-devtools://devtoo
undled/inspector.js (4799)
[5968:0626/095527.874:ERROR:CONSOLE(7574)] "Extension server error: Inspector protocol error: Cannot find context wi
pecified id", source: chrome-devtools://devtools/bundled/inspector.js (7574)
[5968:0626/095527.878:ERROR:CONSOLE(1076)] "Getting IPC events failed", source: chrome-extension://devtron/out/index
(1076)
[5968:0626/095527.878:ERROR:CONSOLE(1077)] "[object Object]", source: chrome-extension://devtron/out/index.js (1077)

// public/electron.js

const { app, BrowserWindow, ipcMain } = require('electron');
const isDev = require('electron-is-dev');

function createWindow() {
  mainWindow = new BrowserWindow({width: 900, height: 680});
  mainWindow.loadURL(isDev ? 'http://localhost:3000' : `file://${path.join(__dirname, '../build/index.html')}`);
  mainWindow.on('closed', () => mainWindow = null);

  if (isDev) {
    // dev tools
    require('devtron').install(); // load devtron
    mainWindow.webContents.openDevTools(); // load chrome dev tools
  }
}

...

let onlineStatus;

// track online/offline status
ipcMain.on('online-status-changed', (event, status) => {
  console.log(status);
  onlineStatus = status;
});

// public/online.js <- loaded via script tag in index.html

const { ipcRenderer } = require('electron');
let onlineStatus = navigator.onLine;

const updateOnlineStatus = () => {
  onlineStatus = navigator.onLine ? 'online' : 'offline';
  ipcRenderer.send('online-status-changed', onlineStatus);
}

window.addEventListener('online',  updateOnlineStatus);
window.addEventListener('offline',  updateOnlineStatus);

updateOnlineStatus();

I can see the console messages being sent back and forth between processes.

@appjitsu appjitsu changed the title No IPC events being shown; ipc chrome tools crash No IPC events being shown; IPC chrome tools crashing Jun 26, 2018
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