0.1.2 • Published 8 years ago

vdom-watched-input v0.1.2

Weekly downloads
2
License
ISC
Repository
github
Last release
8 years ago

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'

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago