tincture

bind to the inputs/outputs of a dom branch

Tincture

bind to the inputs/outputs of a dom branch

npm install tincture

 
<div id="calculator">
  <p>
    width: <input type="text" name="width" data-type="float" />
  </p>
  <p>
    height: <input type="text" name="height" data-type="float" />
  </p>
  <p>
    Area: <span data-output="area"></span>
  </p>
</div>
 
 
var tincture = require('tincture');
 
var component = tincture(document.getElementById('calculator'));
 
component.compute(['width', 'height'], function(widthheight) {
  this.area(width * height);
});
 
component.width.change(function(valprev) {
  console.log('width just changed from', prev, 'to', val);
});
 

To see this example in action visit the examples directory

float, integer

MIT