diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-13 08:16:12 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-13 08:16:52 +0100 |
commit | b2128609ac8159a14224deba399144b3400c8c20 (patch) | |
tree | 4759dfda67c54f6838c3aef0951545ae18bb83bd /thirdparty/preact/src/linked-state.js | |
parent | 3f0ee289c4a61991d0e75906a9bd949cebb39d20 (diff) |
Finally give in and use React, minor tweeks.
Preact (a minimalistic React alternative) had too many bugs ...
Diffstat (limited to 'thirdparty/preact/src/linked-state.js')
-rw-r--r-- | thirdparty/preact/src/linked-state.js | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/thirdparty/preact/src/linked-state.js b/thirdparty/preact/src/linked-state.js deleted file mode 100644 index b6959df73..000000000 --- a/thirdparty/preact/src/linked-state.js +++ /dev/null @@ -1,24 +0,0 @@ -import { isString, delve } from './util'; - -/** 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 - * @private - */ -export function createLinkedState(component, key, eventPath) { - let path = key.split('.'); - return function(e) { - let t = e && e.target || this, - state = {}, - obj = state, - v = isString(eventPath) ? delve(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); - }; -} |