Add Menu.closePopup API on macOS

This commit is contained in:
Kevin Sawicki 2017-02-16 10:58:02 -08:00
parent 947556a23f
commit 6a023dc4fe
8 changed files with 48 additions and 11 deletions

View file

@ -174,6 +174,15 @@ Menu.prototype.popup = function (window, x, y, positioningItem) {
this.popupAt(window, x, y, positioningItem, asyncPopup)
}
Menu.prototype.closePopup = function (window) {
if (window == null || window.constructor !== BrowserWindow) {
window = BrowserWindow.getFocusedWindow()
}
if (window != null) {
this.closePopupAt(window.id)
}
}
Menu.prototype.append = function (item) {
return this.insert(this.getItemCount(), item)
}