Use const/let instead of var
authorKevin Sawicki <kevinsawicki@gmail.com>
Tue, 21 Jun 2016 00:14:16 +0000 (17:14 -0700)
committerKevin Sawicki <kevinsawicki@gmail.com>
Tue, 21 Jun 2016 16:08:13 +0000 (09:08 -0700)
lib/browser/api/menu-item.js

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