vdom-list

0.0.3 • Public • Published

vdom list

Show lists of things with a virtual dom

install

$ npm install vdom-list

example

var vdom = require('virtual-dom');
var h = vdom.h;
var List = require('../List.js');
 
function Link(url, words) {
  return h('a', {href: url}, [words]);
}
 
var state = List({
  items: [
    {
      name: 'location',
      children: ['seattle', 'olympia', 'tangier']
    },
    {
      name: 'meats',
      children: [
        Link('ham', 'ham'),
        Link('fish', 'some kinds of fish'),
        Link('hot-dogs', 'hot dogs')
      ]
    }
  ]
});
 
var loop = require('main-loop')( state(), List.render.bind(null, h), vdom );
state(loop.update);
document.getElementById('content').appendChild(loop.target);

Package Sidebar

Install

npm i vdom-list

Weekly Downloads

0

Version

0.0.3

License

ISC

Last publish

Collaborators

  • nichoth