electron/browser/default_app/main.js
Cheng Zhao d723173bc7 Initial RPC API implementation.
Basic usage is:
remote = require 'remote'
Window = remote.require 'window'
w = new Window { width: 800, height: 600 }

Still need to do:
* Beter support for Array type.
* Remote objects should cheat devtools.
* Support cross-process callbacks.
2013-04-24 16:43:01 +08:00

25 lines
650 B
JavaScript

var atom = require('atom');
var ipc = require('ipc');
var Window = require('window');
var mainWindow = null;
// Echo every message back.
ipc.on('message', function(process_id, routing_id) {
ipc.send.apply(ipc, arguments);
});
ipc.on('sync-message', function(event, process_id, routing_id) {
event.result = arguments;
});
atom.browserMainParts.preMainMessageLoopRun = function() {
mainWindow = new Window({ width: 800, height: 600 });
mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.on('page-title-updated', function(event, title) {
event.preventDefault();
this.setTitle('Atom Shell - ' + title);
});
}