Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nwjs-menu-browser

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nwjs-menu-browser

Context Menu and Menu Bar polyfill for writing NWJS compatible menus in the browser

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

NWJS Menu Browser

Browser Polyfill for NWJS Menu and MenuItem.

Why

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 😎

Caveats

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!

Usage

Demo

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

Build using npm run build, built files will be in ./dist. Coming to npm soon

Including in your project

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>
ES6
import { Menu, MenuItem } from 'nwjs-menu-browser';

if(!nw) {
  var nw = {
    Menu,
    MenuItem
  };
}
ES5
if(!nw) {
  var nw = {};
  nw.Menu = require('nwjs-menu-browser').Menu;
  nw.MenuItem = require('nwjs-menu-browser').MenuItem;
}
Script Tag
<script src=nwjs-menu-browser.js></script>
<script>
if(!nw) {
  var nw = {};
  nw.Menu = window.nwjsMenuBrowser.Menu;
  nw.MenuItem = window.nwjsMenuBrowser.MenuItem;
}
</script>

Screenshots

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 😘

menu-bar

menu-bar

Keywords

FAQs

Package last updated on 17 Apr 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc