remove common sense comments

This commit is contained in:
Shelley Vohr 2017-10-25 12:23:41 -04:00
parent ffd43c1886
commit bccaf56200
No known key found for this signature in database
GPG key ID: F13993A75599653C

View file

@ -43,7 +43,6 @@ Menu.prototype._init = function () {
} }
} }
// create and show a popup
Menu.prototype.popup = function (window, x, y, positioningItem) { Menu.prototype.popup = function (window, x, y, positioningItem) {
let asyncPopup let asyncPopup
let [newX, newY, newPosition, newWindow] = [x, y, positioningItem, window] let [newX, newY, newPosition, newWindow] = [x, y, positioningItem, window]
@ -75,7 +74,6 @@ Menu.prototype.popup = function (window, x, y, positioningItem) {
this.popupAt(newWindow, newX, newY, newPosition, asyncPopup) this.popupAt(newWindow, newX, newY, newPosition, asyncPopup)
} }
// close an existing popup
Menu.prototype.closePopup = function (window) { Menu.prototype.closePopup = function (window) {
if (!window || window.constructor !== BrowserWindow) { if (!window || window.constructor !== BrowserWindow) {
window = BrowserWindow.getFocusedWindow() window = BrowserWindow.getFocusedWindow()
@ -83,7 +81,6 @@ Menu.prototype.closePopup = function (window) {
if (window) this.closePopupAt(window.id) if (window) this.closePopupAt(window.id)
} }
// return a MenuItem with the specified id
Menu.prototype.getMenuItemById = function (id) { Menu.prototype.getMenuItemById = function (id) {
const items = this.items const items = this.items
@ -96,12 +93,10 @@ Menu.prototype.getMenuItemById = function (id) {
return found return found
} }
// append a new MenuItem to an existing Menu
Menu.prototype.append = function (item) { Menu.prototype.append = function (item) {
return this.insert(this.getItemCount(), item) return this.insert(this.getItemCount(), item)
} }
// insert a new menu item at a specified location
Menu.prototype.insert = function (pos, item) { Menu.prototype.insert = function (pos, item) {
if ((item ? item.constructor : void 0) !== MenuItem) { if ((item ? item.constructor : void 0) !== MenuItem) {
throw new TypeError('Invalid item') throw new TypeError('Invalid item')
@ -123,7 +118,6 @@ Menu.prototype.insert = function (pos, item) {
this.commandsMap[item.commandId] = item this.commandsMap[item.commandId] = item
} }
// Force menuWillShow to be called
Menu.prototype._callMenuWillShow = function () { Menu.prototype._callMenuWillShow = function () {
if (this.delegate) this.delegate.menuWillShow() if (this.delegate) this.delegate.menuWillShow()
this.items.forEach(item => { this.items.forEach(item => {
@ -133,7 +127,6 @@ Menu.prototype._callMenuWillShow = function () {
/* Static Methods */ /* Static Methods */
// return application menu
Menu.getApplicationMenu = () => applicationMenu Menu.getApplicationMenu = () => applicationMenu
Menu.sendActionToFirstResponder = bindings.sendActionToFirstResponder Menu.sendActionToFirstResponder = bindings.sendActionToFirstResponder
@ -155,7 +148,6 @@ Menu.setApplicationMenu = function (menu) {
} }
} }
// build a menu by passing in a template
Menu.buildFromTemplate = function (template) { Menu.buildFromTemplate = function (template) {
if (!(template instanceof Array)) { if (!(template instanceof Array)) {
throw new TypeError('Invalid template for Menu') throw new TypeError('Invalid template for Menu')
@ -201,13 +193,11 @@ function generateGroupId (items, pos) {
return groupIdIndex return groupIdIndex
} }
// Returns the index of item according to |id|.
function indexOfItemById (items, id) { function indexOfItemById (items, id) {
const foundItem = items.find(item => item.id === id) || -1 const foundItem = items.find(item => item.id === id) || -1
return items.indexOf(foundItem) return items.indexOf(foundItem)
} }
// Returns the index of where to insert the item according to |position|
function indexToInsertByPosition (items, position) { function indexToInsertByPosition (items, position) {
if (!position) return items.length if (!position) return items.length
@ -242,7 +232,6 @@ function indexToInsertByPosition (items, position) {
return (query in queries) ? queries[query](idx) : idx return (query in queries) ? queries[query](idx) : idx
} }
// insert a new MenuItem depending on its type
function insertItemByType (item, pos) { function insertItemByType (item, pos) {
const types = { const types = {
normal: () => this.insertItem(pos, item.commandId, item.label), normal: () => this.insertItem(pos, item.commandId, item.label),