Skip to content

Instantly share code, notes, and snippets.

@Sawtaytoes
Last active November 8, 2019 05:56
Show Gist options
  • Save Sawtaytoes/a81d298287f8f54e54f41a935afcc277 to your computer and use it in GitHub Desktop.
Save Sawtaytoes/a81d298287f8f54e54f41a935afcc277 to your computer and use it in GitHub Desktop.
function instance($$self, $$props, $$invalidate) {
let count = 0
const stateModifiers = {
DECREMENT: () => {
$$invalidate('count', count -= 1)
},
INCREMENT: () => {
$$invalidate('count', count += 1)
},
}
const store = (
createStore(
stateModifiers
)
)
function click_handler() {
store.dispatch({ type: 'DECREMENT' })
}
function click_handler_1() {
store.dispatch({ type: 'INCREMENT' })
}
return {
count,
store,
click_handler,
click_handler_1
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment