Skip to content

Instantly share code, notes, and snippets.

@ezekielchentnik
Created July 7, 2019 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ezekielchentnik/a1168677b03b10ac9c810bc1a0745a0c to your computer and use it in GitHub Desktop.
Save ezekielchentnik/a1168677b03b10ac9c810bc1a0745a0c to your computer and use it in GitHub Desktop.
function mainView (state, emit) {
return html`
<body>
<h1>count is ${state.count}</h1>
<button onclick=${onclick}>Increment</button>
</body>
`
function onclick () {
emit('increment', 1)
}
}
function countStore (state, emitter) {
state.count = 0
emitter.on('increment', function (count) {
state.count += count
emitter.emit('render')
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment