Package Exports
- vdom-watched-input
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vdom-watched-input) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
vdom-watched-input
Creates an input widget that passes events to a function of your choice
Example
const h = require('virtual-dom/h')
const input = require('vdom-watched-input')
let value = ''
function updatevalue (event) {
console.log('... received event', event)
value = event.target.value
}
function render () {
return h('div', [
new input(updatevalue, {
classname: 'i-has-class',
type: 'text',
value: value
})
])
}
render()usage
input(function callback (event), hyperscriptProperties, eventname)
callback(event) will be run when the event is triggered with the event as the only function argument
hyperscriptProperties are passed directly to virtual-dom/h
If hyperscriptProperties contains a property named enterFn that is a callback function, an event listener will be set for keypresses to run the callback function when the enter key is pressed
eventName defaults to 'input', but for input types like 'checkbox' it is better to use 'change'