Skip to content

Instantly share code, notes, and snippets.

@joliss
Created October 20, 2015 18:49
Show Gist options
  • Save joliss/9e8924695fbccee6ea41 to your computer and use it in GitHub Desktop.
Save joliss/9e8924695fbccee6ea41 to your computer and use it in GitHub Desktop.
class Router {
static build(stuff) {
// Compute compute
// var constructorArg = 123
return new Router(constructorArg)
}
new Router(constructorArg)
route(location) {
return promise
}
}
class MyRouter {
route(location) {
console.log('begin routing ' + location)
return super(location)
.finally(function() {
console.log('end routing ' + location)
})
}
// Yes, I want to inherit .build here, so MyRouter.build(stuff) works.
//
// And if `build` was a `call constructor` instead, I'd want to inherit that.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment