browser-menu
A browser-friendly implementation of substack's terminal-menu
Last updated 6 years ago by hughsk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install browser-menu 
SYNC missed versions from official npm registry.

browser-menu Flattr this!experimental

A browser-friendly implementation of substack's terminal-menu module:

browser-menu

Usage

browser-menu

The API is more or less equivalent to terminal-menu:

menu = createMenu(opts)

Create a menu with opts:

  • opts.width - menu width in em
  • opts.x - top-left corner x offset, default: 1
  • opts.y - top-left corner y offset, default: 1
  • opts.fg - foreground color, default: 'white'
  • opts.bg - background color, default: 'blue'
  • opts.padding.left - left padding in em
  • opts.padding.right - right padding in em
  • opts.padding.top - top padding in em
  • opts.padding.bottom - bottom padding in em

The menu can be driven around with the arrow keys and j/k, vi-style. To quit out of the menu, hit ^C or q.

menu.add(label)

Create a new selectable menu item with the string label.

menu.write(msg)

Write a message to the menu.

menu.reset()

Adds the menu to the document. You can also do this yourself, as menu.element points to the DOM node for the menu.

menu.close()

Unregister all listeners and bring everything back to its original state.

License

MIT. See LICENSE.md for details.

Current Tags

  • 1.0.1                                ...           latest (6 years ago)

8 Versions

  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.2.1                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
  • 0.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 15
Dependencies (7)
Dev Dependencies (2)

Copyright 2014 - 2017 © taobao.org |