diff --git a/lib/runtime/Router/Router.js b/lib/runtime/Router/Router.js index d2a8dbbe..2a95ca27 100644 --- a/lib/runtime/Router/Router.js +++ b/lib/runtime/Router/Router.js @@ -61,6 +61,9 @@ export class Router { /** @type {UrlRewrite[]} */ urlRewrites = [] + /** @type {RouterContext} */ + context + /** @type { import('hookar').HooksCollection } */ beforeRouterInit = createSequenceHooksCollection() /** @type { import('hookar').HooksCollection } */ diff --git a/lib/runtime/Router/Router.svelte b/lib/runtime/Router/Router.svelte index 4c7e90f6..710645be 100644 --- a/lib/runtime/Router/Router.svelte +++ b/lib/runtime/Router/Router.svelte @@ -76,6 +76,7 @@ router = router || new Router(options) router._claimed = true const context = new RouterContext({ router }) + router.context = context router.onMount.run({ context, router }) context.decorators = context.decorators.map(normalizeDecorator)