Use const/let instead of var

This commit is contained in:
Kevin Sawicki 2016-06-20 17:14:16 -07:00
parent 11ba7eaa91
commit 2d8ec60eed

View file

@ -1,11 +1,9 @@
'use strict' 'use strict'
var MenuItem, methodInBrowserWindow, nextCommandId, rolesMap let nextCommandId = 0
nextCommandId = 0
// Maps role to methods of webContents // Maps role to methods of webContents
rolesMap = { const rolesMap = {
undo: 'undo', undo: 'undo',
redo: 'redo', redo: 'redo',
cut: 'cut', cut: 'cut',
@ -20,7 +18,7 @@ rolesMap = {
} }
// Maps methods that should be called directly on the BrowserWindow instance // Maps methods that should be called directly on the BrowserWindow instance
methodInBrowserWindow = { const methodInBrowserWindow = {
minimize: true, minimize: true,
close: true close: true
} }
@ -29,11 +27,11 @@ const methodInApp = {
quit: true quit: true
} }
MenuItem = (function () { const MenuItem = (function () {
MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio'] MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio']
function MenuItem (options) { function MenuItem (options) {
var click, ref let click, ref
const {app, Menu} = require('electron') const {app, Menu} = require('electron')
click = options.click click = options.click
this.selector = options.selector this.selector = options.selector
@ -72,7 +70,7 @@ MenuItem = (function () {
this.commandId = ++nextCommandId this.commandId = ++nextCommandId
this.click = (focusedWindow) => { this.click = (focusedWindow) => {
// Manually flip the checked flags when clicked. // Manually flip the checked flags when clicked.
var methodName, ref1, ref2 let methodName, ref1, ref2
if ((ref1 = this.type) === 'checkbox' || ref1 === 'radio') { if ((ref1 = this.type) === 'checkbox' || ref1 === 'radio') {
this.checked = !this.checked this.checked = !this.checked
} }