Created
March 27, 2017 01:08
-
-
Save guzmonne/ae877f5e7380254b67a761b959963736 to your computer and use it in GitHub Desktop.
Electon ipc example
This file contains hidden or 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
// On the renderer side, we listen for the 'done' event, and for the close | |
// event. We also send the 'open' event when the graphql button is clicked. | |
ipc.on('open:graphql_window:done', (event) => { | |
console.log('open:graphql_window:done') | |
addClass(graphiql, 'hidden') | |
removeClass(graphiqlLoading, 'hidden') | |
}) | |
ipc.on('close:graphql_window', (event) => { | |
console.log('close:graphql_window') | |
addClass(graphiqlLoading, 'hidden') | |
removeClass(graphiql, 'hidden') | |
}) | |
ipc.send('open:graphql_window') | |
// --- | |
// On the main process we listen for the 'open' event, which triggers the | |
// creation of the new window. We set it up so that when that window closes | |
// the UI is alerted. We also tell the UI when the open task is done. | |
ipc.on('open:graphql_window', (event) => { | |
wins.graphql = graphqlWindow.open(() => { | |
wins.graphql = null | |
event.sender.send('close:graphql_window') | |
}) | |
event.sender.send('open:graphql_window:done') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment