Nutty Peanut Marshmallow

    vdom-input

    0.0.11 • Public • Published

    vdom input

    virtual-dom wrapper around an input element. Returns an observable state object usable with the mercury interface.

    install

    $ npm install vdom-input
    

    example

    var vdom = require('virtual-dom');
    var h = vdom.h;
    var Input = require('vdom-input');
     
    // return observable state object
    var state = Input({
     
      value: 'example',
     
      // passed to html element
      attrs: {
        style: {
          color: 'red'
        },
        placeholder: 'placeholder'
      },
     
      // tab in an input that contains text
      onComplete: function() {
        console.log('complete');
      },
      // backspace in an input without any value
      onDelete: function() {
        console.log("delete");
      }
     
    });
     
    var loop = require('main-loop')(state(), Input.render, vdom);
    state(loop.update);
    document.getElementById('content').appendChild(loop.target);

    methods

    Input.hasValue(state)

    Return boolean

    Install

    npm i vdom-input

    DownloadsWeekly Downloads

    3

    Version

    0.0.11

    License

    ISC

    Last publish

    Collaborators

    • nichoth