new Window(args.This(), static_cast<base::DictionaryValue*>(options.get()));
+ // Give js code a chance to do initialization.
+ node::MakeCallback(args.This(), "_init", 0, NULL);
+
return args.This();
}
app.setApplicationMenu = (menu) ->
require('menu').setApplicationMenu menu
+app.getApplicationMenu = ->
+ require('menu').getApplicationMenu()
+
app.commandLine =
appendSwitch: bindings.appendSwitch,
appendArgument: bindings.appendArgument
BrowserWindow = process.atomBinding('window').BrowserWindow
BrowserWindow::__proto__ = EventEmitter.prototype
+BrowserWindow::_init = ->
+ # Simulate the application menu on platforms other than OS X.
+ if process.platform isnt 'darwin'
+ menu = app.getApplicationMenu()
+ @setMenu menu if menu?
+
BrowserWindow::toggleDevTools = ->
opened = v8Util.getHiddenValue this, 'devtoolsOpened'
if opened
windows = app.getBrowserWindows()
w.setMenu menu for w in windows
+Menu.getApplicationMenu = -> applicationMenu
+
Menu.sendActionToFirstResponder = bindings.sendActionToFirstResponder
Menu.buildFromTemplate = (template) ->
},
];
+ var menu = Menu.buildFromTemplate(template);
+ app.setApplicationMenu(menu);
+
// Test if using protocol module would crash.
require('protocol').registerProtocol('test-if-crashes', function() {});
height: 600
});
window.loadUrl('file://' + __dirname + '/index.html');
-
- var menu = Menu.buildFromTemplate(template);
- app.setApplicationMenu(menu);
});