-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removes bindValue, bindChecked. Makes initial render of selects work
- Loading branch information
Showing
7 changed files
with
98 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
/** | ||
stash(element) | ||
stash(element, data) | ||
Quick-and-dirty get or set a value on an element using a WeakMap. Useful for | ||
stashing data for event delegation. Note that the `value` attribute renderer | ||
uses `stash()` internally to store values on elements, which is useful when | ||
you want an `<input>` to have a non-string value. Where an `'input'` or | ||
`'change'` event is delegated these values can be retrieved inside the handler | ||
by getting `stash(input)`. | ||
**/ | ||
|
||
import overload from 'fn/overload.js'; | ||
|
||
export const stash = new WeakMap(); | ||
|
||
export default overload(function() { return arguments.length; }, { | ||
1: (object) => { | ||
return stash.get(object); | ||
}, | ||
|
||
2: (object, value) => { | ||
stash.set(object, value); | ||
return value; | ||
}, | ||
|
||
default: window.DEBUG ? | ||
() => { throw new Error('Literal: stash(element) to get stashed value, stash(element, value) to set stashed value'); } : | ||
undefined | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.