22 lines
519 B
TypeScript
22 lines
519 B
TypeScript
|
import { TemplateResult } from "lit-html";
|
||
|
import { Route } from "./Route";
|
||
|
|
||
|
export class RouteMatch {
|
||
|
route: Route;
|
||
|
arguments: { [key: string]: string; };
|
||
|
fullUrl?: string;
|
||
|
|
||
|
constructor(route: Route) {
|
||
|
this.route = route;
|
||
|
this.arguments = {};
|
||
|
}
|
||
|
|
||
|
render(): TemplateResult {
|
||
|
return this.route.render(this.arguments);
|
||
|
}
|
||
|
|
||
|
toString(): string {
|
||
|
return `<RouteMatch url=${this.fullUrl} route=${this.route} arguments=${JSON.stringify(this.arguments)}>`;
|
||
|
}
|
||
|
}
|