summaryrefslogtreecommitdiff
path: root/packages/frontend/src/nirax.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/frontend/src/nirax.ts')
-rw-r--r--packages/frontend/src/nirax.ts12
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/frontend/src/nirax.ts b/packages/frontend/src/nirax.ts
index 25f853453a..965bd6f0bc 100644
--- a/packages/frontend/src/nirax.ts
+++ b/packages/frontend/src/nirax.ts
@@ -36,6 +36,8 @@ interface RouteDefWithRedirect extends RouteDefBase {
export type RouteDef = RouteDefWithComponent | RouteDefWithRedirect;
+export type RouterFlag = 'forcePage';
+
type ParsedPath = (string | {
name: string;
startsWith?: string;
@@ -107,7 +109,7 @@ export interface IRouter extends EventEmitter<RouterEvent> {
current: Resolved;
currentRef: ShallowRef<Resolved>;
currentRoute: ShallowRef<RouteDef>;
- navHook: ((path: string, flag?: any) => boolean) | null;
+ navHook: ((path: string, flag?: RouterFlag) => boolean) | null;
/**
* ルートの初期化(eventListenerの定義後に必ず呼び出すこと)
@@ -116,11 +118,11 @@ export interface IRouter extends EventEmitter<RouterEvent> {
resolve(path: string): Resolved | null;
- getCurrentPath(): any;
+ getCurrentPath(): string;
getCurrentKey(): string;
- push(path: string, flag?: any): void;
+ push(path: string, flag?: RouterFlag): void;
replace(path: string, key?: string | null): void;
@@ -197,7 +199,7 @@ export class Router extends EventEmitter<RouterEvent> implements IRouter {
private currentKey = Date.now().toString();
private redirectCount = 0;
- public navHook: ((path: string, flag?: any) => boolean) | null = null;
+ public navHook: ((path: string, flag?: RouterFlag) => boolean) | null = null;
constructor(routes: Router['routes'], currentPath: Router['currentPath'], isLoggedIn: boolean, notFoundPageComponent: Component) {
super();
@@ -404,7 +406,7 @@ export class Router extends EventEmitter<RouterEvent> implements IRouter {
return this.currentKey;
}
- public push(path: string, flag?: any) {
+ public push(path: string, flag?: RouterFlag) {
const beforePath = this.currentPath;
if (path === beforePath) {
this.emit('same');