Created
May 11, 2015 03:11
-
-
Save karlbright/6c84883d033c480c9a43 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Cities.statics = { | |
async routerWillRun(state, flux) { | |
return await flux.getActions('cities').getAll() | |
} | |
} |
This file contains hidden or 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
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