stevekinney / firesale-tutorial

A tutorial on building a Markdown renderer in Electron.
MIT License
18 stars 17 forks source link

ipc.on event not firing #7

Closed ghost closed 7 years ago

ghost commented 7 years ago

Can't say for sure why, but in case anyone runs into this issue, you need to wait until the mainWindow.webContents finished loading.

From its doc at: https://github.com/electron/electron/blob/master/docs/api/web-contents.md

  win.webContents.on('did-finish-load', () => {
    win.webContents.send('ping', 'whoooooooh!');
  });

The send function only works without the 'did finish load' callback later on in the tutorial, when it comes to the open file dialog fired by the on click event.

Can anyone explain, why?