Skip to content

Commit

Permalink
Add optional parameter of initialUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
RazzibShakya authored Jan 27, 2022
1 parent ff0ab4e commit 6336471
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/router/Router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ export class Router {
this.mapUrl = mapUrl;
}

setMapUrl = (mapUrl: UrlMapper) => {
if (this.mapUrl) return;
this.mapUrl = mapUrl;
setMapUrl = (mapUrl: UrlMapper, initialUrl?: string) => {
if (this.mapUrl) throw new Error('Url mapper has already been declared');
this.mapUrl = mapUrl;
if (initialUrl) this.setUrl(initialUrl);
};

private getRecentUrl(): string | null {
Expand Down

0 comments on commit 6336471

Please sign in to comment.