Remove CoffeeScript ref variables

This commit is contained in:
Kevin Sawicki 2016-06-20 17:16:34 -07:00
parent 2d8ec60eed
commit 32ea5a5e27

View file

@ -31,9 +31,9 @@ const MenuItem = (function () {
MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio'] MenuItem.types = ['normal', 'separator', 'submenu', 'checkbox', 'radio']
function MenuItem (options) { function MenuItem (options) {
let click, ref
const {app, Menu} = require('electron') const {app, Menu} = require('electron')
click = options.click
const click = options.click
this.selector = options.selector this.selector = options.selector
this.type = options.type this.type = options.type
this.role = options.role this.role = options.role
@ -51,7 +51,7 @@ const MenuItem = (function () {
if ((this.type == null) && (this.submenu != null)) { if ((this.type == null) && (this.submenu != null)) {
this.type = 'submenu' this.type = 'submenu'
} }
if (this.type === 'submenu' && ((ref = this.submenu) != null ? ref.constructor : void 0) !== Menu) { if (this.type === 'submenu' && (this.submenu != null ? this.submenu.constructor : void 0) !== Menu) {
throw new Error('Invalid submenu') throw new Error('Invalid submenu')
} }
this.overrideReadOnlyProperty('type', 'normal') this.overrideReadOnlyProperty('type', 'normal')
@ -70,18 +70,19 @@ const 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.
let methodName, ref1, ref2 if (this.type === 'checkbox' || this.type === 'radio') {
if ((ref1 = this.type) === 'checkbox' || ref1 === 'radio') {
this.checked = !this.checked this.checked = !this.checked
} }
if (this.role && rolesMap[this.role] && process.platform !== 'darwin' && (focusedWindow != null)) { if (this.role && rolesMap[this.role] && process.platform !== 'darwin' && (focusedWindow != null)) {
methodName = rolesMap[this.role] const methodName = rolesMap[this.role]
if(methodInApp[methodName]) { if(methodInApp[methodName]) {
return app[methodName]() return app[methodName]()
} else if (methodInBrowserWindow[methodName]) { } else if (methodInBrowserWindow[methodName]) {
return focusedWindow[methodName]() return focusedWindow[methodName]()
} else { } else {
return (ref2 = focusedWindow.webContents) != null ? ref2[methodName]() : void 0 const {webContents} = focusedWindow
return webContents != null ? webContents[methodName]() : void 0
} }
} else if (typeof click === 'function') { } else if (typeof click === 'function') {
return click(this, focusedWindow) return click(this, focusedWindow)