Corrections to menu.md

This commit is contained in:
Alex Warren 2015-06-09 22:08:34 +01:00
parent 8aa815e6d1
commit 51dc8ad70a

View file

@ -30,7 +30,9 @@ window.addEventListener('contextmenu', function (e) {
Another example of creating the application menu with the simple template API: Another example of creating the application menu with the simple template API:
```javascript ```javascript
// main.js <!-- index.html -->
var remote = require('remote');
var Menu = remote.require('menu');
var template = [ var template = [
{ {
label: 'Electron', label: 'Electron',
@ -69,7 +71,7 @@ var template = [
{ {
label: 'Quit', label: 'Quit',
accelerator: 'Command+Q', accelerator: 'Command+Q',
click: function() { app.quit(); } selector: 'terminate:'
}, },
] ]
}, },
@ -117,12 +119,12 @@ var template = [
{ {
label: 'Reload', label: 'Reload',
accelerator: 'Command+R', accelerator: 'Command+R',
click: function() { BrowserWindow.getFocusedWindow().reloadIgnoringCache(); } click: function() { remote.getCurrentWindow().reloadIgnoringCache(); }
}, },
{ {
label: 'Toggle DevTools', label: 'Toggle DevTools',
accelerator: 'Alt+Command+I', accelerator: 'Alt+Command+I',
click: function() { BrowserWindow.getFocusedWindow().toggleDevTools(); } click: function() { remote.getCurrentWindow().toggleDevTools(); }
}, },
] ]
}, },
@ -156,7 +158,7 @@ var template = [
menu = Menu.buildFromTemplate(template); menu = Menu.buildFromTemplate(template);
Menu.setApplicationMenu(menu); // Must be called within app.on('ready', function(){ ... }); Menu.setApplicationMenu(menu);
``` ```
## Class: Menu ## Class: Menu