Skip to content

Instantly share code, notes, and snippets.

@yoshuawuyts
Last active April 28, 2017 13:34
Show Gist options
  • Save yoshuawuyts/bb5988cc6a920bfe39a15a64a1f17f15 to your computer and use it in GitHub Desktop.
Save yoshuawuyts/bb5988cc6a920bfe39a15a64a1f17f15 to your computer and use it in GitHub Desktop.
var scheduler = Scheduler()
var mainComponent = scheduler.new('main') // create a new component with a name
mainComponent.on('render', function (state, emit) {
return html``
})
mainComponent.on('load', function (done) {
/* trigger an animation that runs for 500ms */
setTimeout(500, done) // wait for animation to complete before calling "done"
})
mainComponent.on('unload', function (done) {
/* trigger an animation that runs for 200ms */
setTimeout(200, done) // wait for animation to complete before calling "done"
})
var app = choo()
app.route('/', function (state, emit) {
return html`
<main>
${scheduler.render('main', state, emit)}
</main>
`
})
app.mount('body')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment