From 51dc8ad70a2228aa2a0137e8f98477fd9ff8fc99 Mon Sep 17 00:00:00 2001 From: Alex Warren Date: Tue, 9 Jun 2015 22:08:34 +0100 Subject: [PATCH] Corrections to menu.md --- docs/api/menu.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/api/menu.md b/docs/api/menu.md index 60e3788..3623adc 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -30,7 +30,9 @@ window.addEventListener('contextmenu', function (e) { Another example of creating the application menu with the simple template API: ```javascript -// main.js + +var remote = require('remote'); +var Menu = remote.require('menu'); var template = [ { label: 'Electron', @@ -69,7 +71,7 @@ var template = [ { label: 'Quit', accelerator: 'Command+Q', - click: function() { app.quit(); } + selector: 'terminate:' }, ] }, @@ -117,12 +119,12 @@ var template = [ { label: 'Reload', accelerator: 'Command+R', - click: function() { BrowserWindow.getFocusedWindow().reloadIgnoringCache(); } + click: function() { remote.getCurrentWindow().reloadIgnoringCache(); } }, { label: 'Toggle DevTools', 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.setApplicationMenu(menu); // Must be called within app.on('ready', function(){ ... }); +Menu.setApplicationMenu(menu); ``` ## Class: Menu -- 2.7.4