control-panel
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -25,5 +25,5 @@ var EventEmitter = require('events').EventEmitter | ||
input.oninput = function (data) { | ||
self.emit('input', data.target.value) | ||
input.onchange = function (data) { | ||
self.emit('input', data.target.checked) | ||
} | ||
} |
{ | ||
"name": "control-panel", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "embeddable panel of inputs for parameter setting", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -24,2 +24,3 @@ # control-panel | ||
Want to contribute a new theme or input type? Submit a PR! | ||
@@ -42,6 +43,6 @@ ## install | ||
var panel = control([ | ||
{type: 'range', label: 'range slider', min: 0, max: 100, initial: 20}, | ||
{type: 'text', label: 'text', initial: 'my cool setting'}, | ||
{type: 'checkbox', label: 'checkbox', initial: true}, | ||
{type: 'color', label: 'color rgb', format: 'rgb', initial: 'rgb(100,200,100)'} | ||
{type: 'range', label: 'my range', min: 0, max: 100, initial: 20}, | ||
{type: 'text', label: 'my text', initial: 'my cool setting'}, | ||
{type: 'checkbox', label: 'my checkbox', initial: true}, | ||
{type: 'color', label: 'my color', format: 'rgb', initial: 'rgb(10,200,0)'} | ||
], | ||
@@ -56,3 +57,3 @@ {theme: 'light', position: 'top-right'} | ||
The first argument is a list of items. Each one must have a `type` and `label` property, and can have an `initial` property with an initial value. For example, | ||
The first argument is a list of inputs. Each one must have a `type` and `label` property, and can have an `initial` property with an initial value. For example, | ||
@@ -71,3 +72,3 @@ ```javascript | ||
- `root` root element to which to append the panel | ||
- `theme` can specify `light` • `dark` or provide an object (see [`theme.js`](theme.js) for format) | ||
- `theme` can specify `light` • `dark` or provide an object (see [`themes.js`](themes.js) for format) | ||
- `title` a title to add to the top of the panel | ||
@@ -77,10 +78,14 @@ - `position` where to place the panel as `top-left` • `top-right` • `bottom-left` • `bottom-right` | ||
#### `panel.on('input')` | ||
#### `panel.on('input', cb(data))` | ||
Emitted every time any of the inputs change. Returns an object with the state of all inputs by label. | ||
This event is emitted every time any one of the inputs change. The callback argument `data` will contain the state of all inputs keyed by label such as: | ||
[npm-image]: https://img.shields.io/badge/npm-v1.0.0-lightgray.svg?style=flat-square | ||
```javascript | ||
{'my checkbox': false, 'my range': 75} | ||
``` | ||
[npm-image]: https://img.shields.io/badge/npm-v1.0.2-lightgray.svg?style=flat-square | ||
[npm-url]: https://npmjs.org/package/control-panel | ||
[standard-image]: https://img.shields.io/badge/code%20style-standard-lightgray.svg?style=flat-square | ||
[standard-url]: https://github.com/feross/standard | ||
[experimental-image]: https://img.shields.io/badge/stability-experimental-lightgray.svg?style=flat-square | ||
[experimental-image]: https://img.shields.io/badge/stability-experimental-lightgray.svg?style=flat-square |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65593
87