https://github.com/davidfig/yy-menu
A menu system for web apps inspired by Electron
https://github.com/davidfig/yy-menu
accelerator menu traditional webapps windows
Last synced: about 1 year ago
JSON representation
A menu system for web apps inspired by Electron
- Host: GitHub
- URL: https://github.com/davidfig/yy-menu
- Owner: davidfig
- Created: 2018-03-08T04:54:46.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-19T03:22:26.000Z (almost 8 years ago)
- Last Synced: 2025-02-26T20:38:40.968Z (about 1 year ago)
- Topics: accelerator, menu, traditional, webapps, windows
- Language: JavaScript
- Size: 4.84 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# yy-menu
A traditional menu system for web apps inspired by Electron. Also includes an implementation of Accelerators to allow keyboard access to the menu (and global keyboard access across the app).
## rationalization
This came together because I wanted to cross-build and release electron apps as web-apps. I needed a replacement for Electron.Menu, Electron.MenuItem, and Electron.Accelerators.
## installation
npm i yy-menu
## simple example
```js
var Menu = require('yy-menu');
var MenuItem = Menu.MenuItem;
var menu = new Menu();
menu.append(new MenuItem({ label: '&Test', accelerator: 'ctrl+b', click: clickCallback }));
var submenu = new Menu();
submenu.append(new MenuItem({ label: 'Check&box', type: 'checkbox', checked: true }));
menu.append(new MenuItem({ label: 'Sub&menu', submenu: submenu }));
// set menu as the application (i.e., top level) menu
Menu.setApplicationMenu(menu);
// register a keyboard shortcut unrelated to menu
Menu.GlobalAccelerator.register('ctrl-a', pressA);
function clickCallback() { console.log('You clicked me!'); }
function pressA() { console.log('you pressed A'); }
```
## live demo
[https://davidfig.github.io/yy-menu](https://davidfig.github.io/yy-menu/)
## API
[https://davidfig.github.io/yy-menu/jsdoc](https://davidfig.github.io/yy-menu/jsdoc)
## License
MIT License
(c) 2018 [YOPEY YOPEY LLC](https://yopeyopey.com/) by [David Figatner](https://twitter.com/yopey_yopey/)