Created
June 7, 2017 13:57
-
-
Save SuddenDevelopment/e58b81e7222d7fc6be86bc9011858d03 to your computer and use it in GitHub Desktop.
electron new window from ipc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get an IPC message from renderer | |
// I put an "action" filed in my ipc messages to switch on | |
ipcMain.on('electron-msg', (event, objMsg) => { | |
//handle incoming message here | |
switch(objMsg.action){ | |
case 'oAuth': | |
// Create a system default browser window. | |
shell.openExternal(objMsg.data.url); | |
// OR navigate the current electron window to the new url | |
mainWindow.loadURL(objMsg.data.url); | |
// OR open a new electron window that can be referenced | |
var oAuthWindow = new BrowserWindow({ width: 480, height: 700, }); | |
var strUrl=objMsg.data.url; | |
oAuthWindow.loadURL(strUrl); | |
break; | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment