Skip to content

Instantly share code, notes, and snippets.

@antenando
Created September 29, 2017 12:04
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 antenando/e97c0247f2f0b3da2675787444cce8a9 to your computer and use it in GitHub Desktop.
Save antenando/e97c0247f2f0b3da2675787444cce8a9 to your computer and use it in GitHub Desktop.
choo onload
import choo from 'choo'
import html from 'choo/html'
import log from 'choo-log'
import onload from 'on-load'
const app = choo()
app.use(log())
export const atestView = (state, emit) => {
function onloadFn(el) {
console.log('onLoad!', el);
}
return html`
<div onload=${onloadFn}>
<h1>test!</h1>
</div>
`
}
export const testView = (state, emit) => {
function onloadFn(el) {
console.log('onLoad!', el);
}
const tree = html`
<div>
<h1>test!</h1>
</div>
`
onload(tree, onloadFn)
return tree
}
app.route('*', testView)
app.mount('#root')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment