Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
50e14811d4 | |||
f7e5af4113 |
2
package-lock.json
generated
2
package-lock.json
generated
@ -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": {
|
||||||
|
@ -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",
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user