demo/preact-todomvc/app.js
function linkState(component, key, eventPath) {
    var path = key.split('.'),
      cache = component.__lsc || (component.__lsc = {});
    return (
      cache[key + eventPath] ||
      (cache[key + eventPath] = function(e) {
        var t = (e && e.target) || this,
          state = {},
          obj = state,
          v = typeof eventPath === 'string' ? dlv(e, eventPath) : t.nodeName ? (t.type.match(/^che|rad/) ? t.checked : t.value) : e,
          i = 0;

        for (; i < path.length - 1; i++) {
          obj = obj[path[i]] || (obj[path[i]] = (!i && component.state[path[i]]) || {});
        }

        obj[path[i]] = v;
        component.setState(state);
      })
    );
  }
function linkState(component, key, eventPath) {
    var path = key.split('.'),
      cache = component.__lsc || (component.__lsc = {});
    return (
      cache[key + eventPath] ||
      (cache[key + eventPath] = function(e) {
        var t = (e && e.target) || this,
          state = {},
          obj = state,
          v = typeof eventPath === 'string' ? dlv(e, eventPath) : t.nodeName ? (t.type.match(/^che|rad/) ? t.checked : t.value) : e,
          i = 0;

        for (; i < path.length - 1; i++) {
          obj = obj[path[i]] || (obj[path[i]] = (!i && component.state[path[i]]) || {});
        }

        obj[path[i]] = v;
        component.setState(state);
      })
    );
  }
function linkState ( component , key , eventPath ) { var path = key . split ( '.' ) , cache = component . __lsc || ( component . __lsc = { } ) ; return ( cache [ key + eventPath ] || ( cache [ key + eventPath ] = function ( e ) { var t = ( e && e . target ) || this , state = { } , obj = state , v = typeof eventPath === 'string' ? dlv ( e , eventPath ) : t . nodeName ? ( t . type . match ( / ^che|rad / ) ? t . checked : t . value ) : e , i = 0 ; for ( ; i < path . length - 1 ; i ++ ) { obj = obj [ path [ i ] ] || ( obj [ path [ i ] ] = ( ! i && component . state [ path [ i ] ] ) || { } ) ; } obj [ path [ i ] ] = v ; component . setState ( state ) ; } ) ) ; }
Create an Event handler function that sets a given state property.
@param {Component} component	The component whose state should be updated
@param {string} key				A dot-notated key path to update in the component's state
@param {string} eventPath		A dot-notated key path to the value that should be retrieved from the Event or component
@returns {function} linkedStateHandler
Create an Event handler function that sets a given state property .