Handle IPC messages in webContents instead of BrowserWindow.

This commit is contained in:
Cheng Zhao 2014-04-25 16:13:16 +08:00
parent 1815f8b40d
commit c0875864dc
21 changed files with 138 additions and 421 deletions

View file

@ -8,8 +8,8 @@ var window = null;
app.commandLine.appendSwitch('js-flags', '--expose_gc');
ipc.on('message', function() {
ipc.send.apply(this, arguments);
ipc.on('message', function(event, arg) {
event.sender.send('message', arg);
});
ipc.on('console.log', function(pid, rid, args) {
@ -24,11 +24,11 @@ ipc.on('process.exit', function(pid, rid, code) {
process.exit(code);
});
ipc.on('eval', function(ev, pid, rid, script) {
ipc.on('eval', function(ev, script) {
ev.returnValue = eval(script);
});
ipc.on('echo', function(ev, pid, rid, msg) {
ipc.on('echo', function(ev, msg) {
ev.returnValue = msg;
});