Skip to content

Instantly share code, notes, and snippets.

@karlbright
Created May 11, 2015 03:11
Show Gist options
  • Save karlbright/6c84883d033c480c9a43 to your computer and use it in GitHub Desktop.
Save karlbright/6c84883d033c480c9a43 to your computer and use it in GitHub Desktop.
Cities.statics = {
async routerWillRun(state, flux) {
return await flux.getActions('cities').getAll()
}
}
function performRouteHandlerStaticMethod(routes, methodName, ...args) {
return Promise.all(routes
.map(route => route.handler.statics && route.handler.statics[methodName])
.filter(method => typeof method === 'function')
.map(method => method(...args))
)
}
export default performRouteHandlerStaticMethod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment