Added CC Navbar
This commit is contained in:
@@ -7,6 +7,7 @@ export type Route = {
|
||||
export class Router {
|
||||
private routes: Route[];
|
||||
private outlet: HTMLElement;
|
||||
onRouteChange?: (path: string) => void;
|
||||
|
||||
constructor(outlet: HTMLElement, routes: Route[]) {
|
||||
this.routes = routes;
|
||||
@@ -26,5 +27,9 @@ export class Router {
|
||||
this.outlet.append(
|
||||
match ? match.view() : document.createElement('not-found-page')
|
||||
);
|
||||
|
||||
if (this.onRouteChange) {
|
||||
this.onRouteChange(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user