Main.js External function call from a.js script file


#1

Created two window using single main.js …second window will open only if first window function value is
valid. So I have to put condition before second window opens. What do i do?


#2

Create a new BrowserWindow with show as false:

secondWindow = new BrowserWindow({
    show: false
  })

not sure how to get hold of the condition is true, but do something like this :

if(myCondition) {
    secondWindow.show()
}

#3

Came to think about that you can probably use ipcRenderer.send() from the first window and then listen to that event in main.js, and when fired use secondwindow.show()

http://electron.atom.io/docs/api/ipc-main/


#4

I just wrote a tutorial on this topic. If you still need it, or anyone else comes across this thread you can follow the steps here: http://www.christianengvall.se/ipcmain-and-ipcrenderer/