Route emit

This commit is contained in:
Max Lynch
2015-04-28 15:53:16 -05:00
parent acbafd4fce
commit ee678856e9
2 changed files with 9 additions and 1 deletions

View File

@ -18,6 +18,7 @@ export class Router {
if(routeParams !== false) {
route.exec(this.buildRouteParams(routeParams));
this.emit(route.url)
return
}
}
@ -25,6 +26,10 @@ export class Router {
return this.noMatch();
}
emit(path) {
window.location.hash = path
}
buildRouteParams(routeParams) {
routeParams._route = {
path: window.location.hash.slice(1)
@ -50,6 +55,7 @@ export class Router {
if((routeParams = route.match(path)) !== false) {
console.log('OTHERWISE: route matched:', route.url);
route.exec(routeParams)
this.emit(route.url)
}
}
}