Skip to content

Instantly share code, notes, and snippets.

@jonofoz
Created August 17, 2017 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonofoz/12b8cdb5d5e66b936caef7c14d80ef38 to your computer and use it in GitHub Desktop.
Save jonofoz/12b8cdb5d5e66b936caef7c14d80ef38 to your computer and use it in GitHub Desktop.
atom-shell-issue-991
<h1>Hi, I'm index1.html aka win1</h1>
<script>
function sendIpcMsg() {
var ipc = require('ipc');
ipc.send('my-msg', 'hi');
}
</script>
<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>
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);
});
});
{
"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