https://github.com/paxa/nw-appmenu
nwjs helper to work with application menu
https://github.com/paxa/nw-appmenu
Last synced: 2 months ago
JSON representation
nwjs helper to work with application menu
- Host: GitHub
- URL: https://github.com/paxa/nw-appmenu
- Owner: Paxa
- Created: 2015-04-28T18:59:17.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-14T18:50:42.000Z (about 11 years ago)
- Last Synced: 2025-03-01T00:37:46.898Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nw-appmenu
Helper to work with application menu in nwjs (node-webkit)
#### Install:
```
npm install nw-appmenu
```
#### Example:
```js
var AppMenu = require('nw-appmenu');
// we will add Zoom In, Zoom Out, Inspector, Reload, Help items to window menu
var menu = {
'Window': {
'separator': 'separator',
'Zoom in': {
click: function () {
gui.Window.get().zoomLevel += 0.5;
},
key: '+'
},
'Zoom out': {
click: function () {
gui.Window.get().zoomLevel -= 0.5;
},
key: '-'
},
'Zoom to noraml': {
click: function () {
gui.Window.get().zoomLevel = 0;
},
key: '0'
},
'separator2': 'separator',
Inspector: {
click: function () {
var win = gui.Window.get();
if (win.isDevToolsOpen()) {
win.closeDevTools();
} else {
win.showDevTools();
}
},
key: 'i'
},
Reload: {
click: function () {
gui.Window.get().reloadDev();
},
key: 'r'
},
Help: function() {
window.alert("help window");
}
}
};
AppMenu.createAndExtend(menu);
```

I extrac this code from [Postbird](https://github.com/Paxa/postbird), please see `example_app` folder for more features and options.