2.1.0 • Published 2 months ago

yy-menu v2.1.0

Weekly downloads
5
License
MIT
Repository
github
Last release
2 months ago

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. I rarely use Electron anymore, but I still find this library useful for some webapps.

installation

npm i yy-menu

simple example

import { Menu, MenuItem, localAccelerator } from 'yy-menu';

const 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
localAccelerator.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

API

https://davidfig.github.io/yy-menu/jsdoc

License

MIT License
(c) 2020 YOPEY YOPEY LLC by David Figatner

2.1.0

2 months ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

3 years ago

1.5.0

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.4

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago