From 250c656aa760fc8aa1d7ce315dd8664b1aefa3e6 Mon Sep 17 00:00:00 2001 From: Zeke Sikelianos Date: Mon, 27 Feb 2017 09:34:35 -0800 Subject: [PATCH] lint --- docs/tutorial/shortcuts.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/docs/tutorial/shortcuts.md b/docs/tutorial/shortcuts.md index dee0e10e177b..9b20d23f6d6f 100644 --- a/docs/tutorial/shortcuts.md +++ b/docs/tutorial/shortcuts.md @@ -14,7 +14,7 @@ const menu = new Menu() menu.append(new MenuItem({ label: 'Print', - accelerator: 'CmdOrCtrl+P' + accelerator: 'CmdOrCtrl+P', click: () => { console.log('time to print stuff') } })) ``` @@ -55,28 +55,27 @@ Note the third parameter `true` which means the listener will always receive key If you don't want to do manual shortcut parsing there are libraries that do advanced key detection such as [mousetrap]. ```js -Mousetrap.bind('4', function () { console.log('4')}) -Mousetrap.bind('?', function () { console.log('show shortcuts!')}) -Mousetrap.bind('esc', function () { console.log('escape')}, 'keyup') +Mousetrap.bind('4', () => { console.log('4') }) +Mousetrap.bind('?', () => { console.log('show shortcuts!') }) +Mousetrap.bind('esc', () => { console.log('escape') }, 'keyup') // combinations -Mousetrap.bind('command+shift+k', function () { console.log('command shift k')}) +Mousetrap.bind('command+shift+k', () => { console.log('command shift k') }) // map multiple combinations to the same callback -Mousetrap.bind(['command+k', 'ctrl+k'], function () { +Mousetrap.bind(['command+k', 'ctrl+k'], () => { console.log('command k or control k') - // return false to prevent default browser behavior - // and stop event from bubbling + // return false to prevent default behavior and stop event from bubbling return false }) // gmail style sequences -Mousetrap.bind('g i', function () { console.log('go to inbox')}) -Mousetrap.bind('* a', function () { console.log('select all')}) +Mousetrap.bind('g i', () => { console.log('go to inbox') }) +Mousetrap.bind('* a', () => { console.log('select all') }) // konami code! -Mousetrap.bind('up up down down left right left right b a enter', function () { +Mousetrap.bind('up up down down left right left right b a enter', () => { console.log('konami code') }) ```