unified-state
Glue together components and event handlers
Motivation
This code is taken from mercury which allows you to create a state that binds event handlers (also referred to as channels
or handles
) using dom-delegator. Ideal for instances where you don't want to require the entire mercury package.
Install
$ npm install unified-state
Usage
Here's a modified version of the mercury's trivial example on their README
'use strict' var document = var extend = var main = var observ = var send = var unified = var h = var virtualize = var Delegator = { return } { statevalue} App { return } var target = documentbodyfirstChild var opts = initialTree: target: target var app = var loop = app
API
unified(obj) -> observ-struct
obj
refers to a key/value object containing components/values and event-handlers (channels or handles). Returns an object with fixed key/value pairs observ-struct and an updated dom-delegator instance with bound handlers. See above example.
License
MIT