router-dom
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -16,2 +16,5 @@ import { pathToRegexp, match } from "path-to-regexp"; | ||
export default class Router { | ||
options; | ||
routes; | ||
oldRoute; | ||
constructor(routes, options = {}) { | ||
@@ -50,15 +53,17 @@ // Handle nested routes | ||
fetchCache.set(route, cache); | ||
//@ts-expect-error | ||
requestIdleCallback(() => { | ||
cache.promise = fetch(route.templateUrl, { | ||
signal: controller.signal, | ||
setTimeout(() => { | ||
//@ts-expect-error | ||
requestIdleCallback(() => { | ||
cache.promise = fetch(route.templateUrl, { | ||
signal: controller.signal, | ||
}); | ||
cache.promise | ||
.then((res) => res.text()) | ||
.then((_html) => { | ||
cache.html = _html; | ||
}) | ||
.catch(async (err) => { | ||
await this.options.errorHandler?.(err); | ||
}); | ||
}); | ||
cache.promise | ||
.then((res) => res.text()) | ||
.then((_html) => { | ||
cache.html = _html; | ||
}) | ||
.catch(async (err) => { | ||
await this.options.errorHandler?.(err); | ||
}); | ||
}); | ||
@@ -65,0 +70,0 @@ } |
{ | ||
"name": "router-dom", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "A lightweight router for everyone", | ||
@@ -29,6 +29,6 @@ "type": "module", | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@web/test-runner": "^0.13.4", | ||
"@web/test-runner": "^0.13.5", | ||
"@web/test-runner-playwright": "^0.8.6", | ||
"esbuild": "^0.12.1", | ||
"typescript": "^4.2.4" | ||
"esbuild": "^0.12.4", | ||
"typescript": "^4.3.2" | ||
}, | ||
@@ -35,0 +35,0 @@ "repository": { |
@@ -61,15 +61,17 @@ import type { MatchResult } from "path-to-regexp"; | ||
fetchCache.set(route, cache); | ||
//@ts-expect-error | ||
requestIdleCallback(() => { | ||
cache.promise = fetch(route.templateUrl!, { | ||
signal: controller.signal, | ||
setTimeout(() => { | ||
//@ts-expect-error | ||
requestIdleCallback(() => { | ||
cache.promise = fetch(route.templateUrl!, { | ||
signal: controller.signal, | ||
}); | ||
(cache.promise as unknown as Promise<Response>) | ||
.then((res) => res.text()) | ||
.then((_html) => { | ||
cache.html = _html; | ||
}) | ||
.catch(async (err) => { | ||
await this.options.errorHandler?.(err); | ||
}); | ||
}); | ||
(cache.promise as unknown as Promise<Response>) | ||
.then((res) => res.text()) | ||
.then((_html) => { | ||
cache.html = _html; | ||
}) | ||
.catch(async (err) => { | ||
await this.options.errorHandler?.(err); | ||
}); | ||
}); | ||
@@ -76,0 +78,0 @@ } |
54732
656