router/index.ts

22 lines
724 B
TypeScript
Raw Normal View History

2024-04-25 20:49:38 +08:00
import 'elexis';
import { Router } from './lib/Router';
declare module 'elexis' {
export namespace $ {
export const routers: Set<Router>;
export function open(path: string | URL | undefined): typeof Router;
export function replace(path: string | URL | undefined): typeof Router;
export function back(): typeof Router;
}
}
Object.assign($, {
2024-10-01 17:56:22 +08:00
routers: Router.routers,
2024-04-25 20:49:38 +08:00
open(path: string | URL | undefined) { return Router.open(path) },
replace(path: string | URL | undefined) { return Router.replace(path) },
back() { return Router.back() }
})
2024-10-01 17:56:22 +08:00
addEventListener('popstate', Router.popstate); // Start listening
2024-04-25 20:49:38 +08:00
export * from './lib/Route';
export * from './lib/Router';