Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
nwjs-menu-browser
Advanced tools
Context Menu and Menu Bar polyfill for writing NWJS compatible menus in the browser
Browser Polyfill for NWJS Menu and MenuItem.
My audio visualisation app modV recently moved to NWJS and I had previously built my own (terrible) context menus for the browser. So as not to write two lots of code I thought I'd polyfill the browser so you could use the same code between NWJS and (presumably) Chrome!
This can also be used as a regular Context Menu library if so wished 😎
Does not support createMacBuiltIn
, MenuItem.key
or MenuItem.modifiers
, though usage of these will not break existing code and will be displayed in the menu nodes.
These menus are not checked against any OS menu specification, but it's close enough to polyfill for the browser. If you'd like more accurate functionality, PRs and enhancement issues are welcome!
Run npm run watch
and a browser window pointing to localhost:8080
will open.
(the demo is not included in the NPM package, please clone from git)
Build using npm run build
, built files will be in ./dist
.
Coming to npm soon
The included stylesheet in dist
is optional, but you will need some sort of style for your menus.
<link rel=stylesheet type=text/css href=nwjs-menu-browser.css>
import { Menu, MenuItem } from 'nwjs-menu-browser';
if(!nw) {
var nw = {
Menu,
MenuItem
};
}
if(!nw) {
var nw = {};
nw.Menu = require('nwjs-menu-browser').Menu;
nw.MenuItem = require('nwjs-menu-browser').MenuItem;
}
<script src=nwjs-menu-browser.js></script>
<script>
if(!nw) {
var nw = {};
nw.Menu = window.nwjsMenuBrowser.Menu;
nw.MenuItem = window.nwjsMenuBrowser.MenuItem;
}
</script>
The included stylesheet (nwjs-menu-browser.css
) is a close match to macOS Sierra's menus.
If somebody would like to contribute extra 'themes' I'd be very happy 😘
FAQs
Context Menu and Menu Bar polyfill for writing NWJS compatible menus in the browser
We found that nwjs-menu-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.