src/bind.js
function range(bind, el, param, value) {
  value = value !== undefined ? value : ((+param.max) + (+param.min)) / 2;

  var min = param.min || Math.min(0, +value) || 0,
      max = param.max || Math.max(100, +value) || 100,
      step = param.step || tickStep(min, max, 100);

  var node = element('input', {
    type:  'range',
    name:  param.signal,
    min:   min,
    max:   max,
    step:  step
  });
  node.value = value;

  var label = element('label', {}, +value);

  el.appendChild(node);
  el.appendChild(label);

  function update() {
    label.textContent = node.value;
    bind.update(+node.value);
  }

  // subscribe to both input and change
  node.addEventListener('input', update);
  node.addEventListener('change', update);

  bind.elements = [node];
  bind.set = function(value) {
    node.value = value;
    label.textContent = value;
  };
}
function range(bind, el, param, value) {
  value = value !== undefined ? value : ((+param.max) + (+param.min)) / 2;

  var min = param.min || Math.min(0, +value) || 0,
      max = param.max || Math.max(100, +value) || 100,
      step = param.step || tickStep(min, max, 100);

  var node = element('input', {
    type:  'range',
    name:  param.signal,
    min:   min,
    max:   max,
    step:  step
  });
  node.value = value;

  var label = element('label', {}, +value);

  el.appendChild(node);
  el.appendChild(label);

  function update() {
    label.textContent = node.value;
    bind.update(+node.value);
  }

  // subscribe to both input and change
  node.addEventListener('input', update);
  node.addEventListener('change', update);

  bind.elements = [node];
  bind.set = function(value) {
    node.value = value;
    label.textContent = value;
  };
}
function range ( bind , el , param , value ) { value = value !== undefined ? value : ( ( + param . max ) + ( + param . min ) ) / 2 ; var min = param . min || Math . min ( 0 , + value ) || 0 , max = param . max || Math . max ( 100 , + value ) || 100 , step = param . step || tickStep ( min , max , 100 ) ; var node = element ( 'input' , { type : 'range' , name : param . signal , min : min , max : max , step : step } ) ; node . value = value ; var label = element ( 'label' , { } , + value ) ; el . appendChild ( node ) ; el . appendChild ( label ) ; function update ( ) { label . textContent = node . value ; bind . update ( + node . value ) ; } // subscribe to both input and change node . addEventListener ( 'input' , update ) ; node . addEventListener ( 'change' , update ) ; bind . elements = [ node ] ; bind . set = function ( value ) { node . value = value ; label . textContent = value ; } ; }
Generates a slider input element.
Generates a slider input element .