Last active
July 29, 2020 18:22
-
-
Save shiftyp/8fa115b2e08c5c9ef36ed7c7acc086f9 to your computer and use it in GitHub Desktop.
Alternative Wicked API
This file contains hidden or 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
wickedElements.define('.my-counter', (element, { events, changes, values }) => { | |
const counter = element.querySelector('.count') | |
const minus = element.querySelector('.minus') | |
const plus = element.querySelector('.plus') | |
changes(values).count(count => { | |
counter.textContent = count | |
}) | |
values.count = 0 | |
events(minus).click(() => values.count--) | |
events(plus).click(() => values.count++) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment