Created
August 17, 2017 03:07
-
-
Save jonofoz/12b8cdb5d5e66b936caef7c14d80ef38 to your computer and use it in GitHub Desktop.
atom-shell-issue-991
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
<h1>Hi, I'm index1.html aka win1</h1> | |
<script> | |
function sendIpcMsg() { | |
var ipc = require('ipc'); | |
ipc.send('my-msg', 'hi'); | |
} | |
</script> |
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
<h1>Hi, I'm index2.html aka win2</h1> | |
<script> | |
var ipc = require('ipc'); | |
ipc.on('my-msg', function(arg) { | |
console.log('this was sent from win1', arg); | |
}); | |
</script> |
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
var app = require('app'); | |
var BrowserWindow = require('browser-window'); | |
var ipc = require('ipc'); | |
app.on('ready', function() { | |
win1 = new BrowserWindow({ | |
"width": 400, | |
"height": 600 | |
}); | |
win1.loadUrl('file://' + __dirname + '/index1.html'); | |
win1.show(); | |
win1.openDevTools(); | |
win2 = new BrowserWindow({ | |
"width": 400, | |
"height": 600 | |
}); | |
win2.loadUrl('file://' + __dirname + '/index2.html'); | |
win2.show(); | |
win2.openDevTools(); | |
ipc.on('my-msg', function(event, arg) { | |
win2.webContents.send('my-msg', arg); | |
}); | |
}); |
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
{ | |
"name": "atom-shell-issue-991", | |
"main": "main.js" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment