router/index.ts
defaultkavy 5ebfab0ef4
v0.2.0
update: rewrite router extensions, rewrite README
new: $Router, $Route class module
remove: Router, Route class module
change: The way create Router and Route is changed.
2024-10-02 00:58:23 +08:00

25 lines
838 B
TypeScript

import 'elexis';
import { $Router } from './lib/$Router';
import { $Route } from './lib/$Route';
declare module 'elexis' {
export namespace $ {
export interface TagNameElementMap {
'router': typeof $Router;
'route': typeof $Route;
}
export function open(path: string | URL | undefined): typeof $Router;
export function replace(path: string | URL | undefined): typeof $Router;
export function back(): typeof $Router;
}
}
$.registerTagName('router', $Router);
$.registerTagName('route', $Route);
Object.assign($, {
open(path: string | URL | undefined) { return $Router.open(path) },
replace(path: string | URL | undefined) { return $Router.replace(path) },
back() { return $Router.back() }
})
export * from './lib/$Route';
export * from './lib/$Router';