Created
September 29, 2017 12:04
-
-
Save antenando/e97c0247f2f0b3da2675787444cce8a9 to your computer and use it in GitHub Desktop.
choo onload
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
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