2 Commits

Author SHA1 Message Date
50e14811d4 1.0.5 2020-11-30 01:38:22 +00:00
f7e5af4113 fix(core): update 2020-11-30 01:38:21 +00:00
3 changed files with 4 additions and 4 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartrouter", "name": "@pushrocks/smartrouter",
"version": "1.0.4", "version": "1.0.5",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "@pushrocks/smartrouter", "name": "@pushrocks/smartrouter",
"version": "1.0.4", "version": "1.0.5",
"private": false, "private": false,
"description": "a router for routing on websites", "description": "a router for routing on websites",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@ -80,11 +80,11 @@ export class SmartRouter {
*/ */
async _handleRouteState() { async _handleRouteState() {
const currentLocation = window.location.pathname; const currentLocation = window.location.pathname;
const wantedRoute = this.routes.find((routeArg) => { const wantedRoutes = this.routes.filter((routeArg) => {
return !!routeArg.matchFunction(currentLocation); return !!routeArg.matchFunction(currentLocation);
}); });
if (wantedRoute) { for (const wantedRoute of wantedRoutes) {
const routeResult = wantedRoute.matchFunction(currentLocation); const routeResult = wantedRoute.matchFunction(currentLocation);
await wantedRoute.handler(routeResult.valueOf() as IRouteInfo); await wantedRoute.handler(routeResult.valueOf() as IRouteInfo);
} }