Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

Commit

Permalink
refactor: reset previously matched route on hash change
Browse files Browse the repository at this point in the history
  • Loading branch information
sundowndev committed May 14, 2019
1 parent 608b18b commit 7456e3c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/leafeon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ export class Router extends RouterRequest {
this.notfound = true; // While a route has not match the URI, set page as not found
this.routes = [];
this.paramsEnabled = false;
this.route = null;
this.params = [];
this.beforeRouteMiddleware = '*';
this.routeCall = () => {};
this.beforeRouteMiddlewareFunc = () => {};
this.afterRouteCallback = () => {};
this.route = {};
this.notFoundCallback = () => {};
this.routeCall = null;
this.beforeRouteMiddlewareFunc = null;
this.afterRouteCallback = null;
this.notFoundCallback = null;

this.windowListener(this.run);
}
Expand Down Expand Up @@ -314,6 +314,11 @@ export class Router extends RouterRequest {
* @param afterRouteCallback
*/
public run = (afterRouteCallback?: any): void => {
this.route = null;
this.routeCall = null;
this.params = [];
this.notfound = true;

const URI = this.getURI();
const routes: Array<any> = [];

Expand Down

0 comments on commit 7456e3c

Please sign in to comment.