-
-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use class for DefaultResolver to improve extensibility
- Loading branch information
1 parent
11b0941
commit bdd45cb
Showing
4 changed files
with
29 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import Mithril from 'mithril'; | ||
|
||
/** | ||
* Generates a route resolver for a given component, to which it provides | ||
* a key as a 'routeName' attr. | ||
*/ | ||
export default class DefaultResolver { | ||
component: Mithril.Component; | ||
routeName: string; | ||
|
||
constructor(component, routeName) { | ||
this.component = component; | ||
this.routeName = routeName; | ||
} | ||
|
||
onmatch(args, requestedPath, route) { | ||
return this.component; | ||
} | ||
|
||
render(vnode) { | ||
vnode.attrs.routeName = this.routeName; | ||
|
||
return vnode; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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