electron/browser/default_app/main.js
2013-05-03 15:36:25 +08:00

31 lines
778 B
JavaScript

var app = require('app');
var atom = require('atom');
var ipc = require('ipc');
var Window = require('window');
var mainWindow = null;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
app.terminate();
});
// 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);
});
}