Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Cool async stuff
import m from 'mithril'
import store from '../../store'
import {loadUsers} from '../../data/users/actions'
import layout from '../../components/layout'
if (typeof require.ensure !== 'function') require.ensure = (d, c) => c(require)
async function getJs(){
return (await require('./users.js')).default
async function getData(){
return window.__STATE_IS_PRELOADED__ || store().dispatch(loadUsers())
export default {
async onmatch () {
const [ users, ] = await Promise.all([
this.users = users
window.__STATE_IS_PRELOADED__ = false
render (vnode) {
this.title = 'Users - Mithril'
this.description = 'Users Page'
document.title = this.title
return m(layout, vnode.attrs, m(this.users, vnode.attrs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.