Expose Menu API in javascript.
This commit is contained in:
parent
13c0a05fdd
commit
d6103dd639
2 changed files with 20 additions and 0 deletions
1
atom.gyp
1
atom.gyp
|
@ -13,6 +13,7 @@
|
||||||
'browser/api/lib/atom_delegate.coffee',
|
'browser/api/lib/atom_delegate.coffee',
|
||||||
'browser/api/lib/dialog.coffee',
|
'browser/api/lib/dialog.coffee',
|
||||||
'browser/api/lib/ipc.coffee',
|
'browser/api/lib/ipc.coffee',
|
||||||
|
'browser/api/lib/menu.coffee',
|
||||||
'browser/api/lib/window.coffee',
|
'browser/api/lib/window.coffee',
|
||||||
'browser/atom/atom.coffee',
|
'browser/atom/atom.coffee',
|
||||||
'browser/atom/objects_registry.coffee',
|
'browser/atom/objects_registry.coffee',
|
||||||
|
|
19
browser/api/lib/menu.coffee
Normal file
19
browser/api/lib/menu.coffee
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
EventEmitter = require('events').EventEmitter
|
||||||
|
Window = require 'window'
|
||||||
|
|
||||||
|
Menu = process.atomBinding('menu').Menu
|
||||||
|
Menu::__proto__ = EventEmitter.prototype
|
||||||
|
|
||||||
|
popup = Menu::popup
|
||||||
|
Menu::popup = (window) ->
|
||||||
|
throw new TypeError('Invalid window') unless window?.constructor is Window
|
||||||
|
|
||||||
|
popup.call this, window
|
||||||
|
|
||||||
|
Menu::appendItem = (args...) -> @insertItem -1, args...
|
||||||
|
Menu::appendCheckItem = (args...) -> @insertCheckItem -1, args...
|
||||||
|
Menu::appendRadioItem = (args...) -> @insertRadioItem -1, args...
|
||||||
|
Menu::appendSeparator = (args...) -> @insertSeparator -1, args...
|
||||||
|
Menu::appendSubMenu = (args...) -> @insertSubMenu -1, args...
|
||||||
|
|
||||||
|
module.exports = Menu
|
Loading…
Reference in a new issue