Skip to content
This repository was archived by the owner on Dec 19, 2017. It is now read-only.

Commit 7666e35

Browse files
authoredJan 11, 2017
export Router with a ctor
1 parent 9e53237 commit 7666e35

File tree

1 file changed

+31
-21
lines changed

1 file changed

+31
-21
lines changed
 

‎ko-component-router.d.ts

+31-21
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,38 @@ interface KoComponentRouterConfig {
5757
}
5858

5959
declare module 'ko-component-router' {
60-
interface RouterStatic extends KoComponentRouterInstance {
61-
}
62-
namespace RouterStatic {
63-
export var config: KoComponentRouterConfig;
64-
export var middleware: KoComponentRouterMiddleware[];
65-
export var plugins: any[];
66-
export var routes: KoComponentRouterRoutes;
67-
export const head: KoComponentRouterInstance;
68-
export const tail: KoComponentRouterInstance;
60+
class Router implements KoComponentRouterInstance {
61+
static config: KoComponentRouterConfig;
62+
static middleware: KoComponentRouterMiddleware[];
63+
static plugins: any[];
64+
static routes: KoComponentRouterRoutes;
65+
static head: KoComponentRouterInstance;
66+
static tail: KoComponentRouterInstance;
67+
68+
static canonicalizePath(path: string): string;
69+
static get(index: number): KoComponentRouterInstance;
70+
static getPath(url: string): string;
71+
static parseUrl(url: string): { hash: string, pathname: string, search: string };
72+
static sameOrigin(href: string): boolean;
73+
static setConfig(config: KoComponentRouterConfig): void;
74+
static update(path: string, push?: boolean): Promise<boolean>;
75+
static update(path: string, options: { push?: boolean; force?: boolean; with?: any }): Promise<boolean>;
76+
static use(...middleware: KoComponentRouterMiddleware[]): void;
77+
static usePlugin(...fns): void;
78+
static useRoutes(routes: KoComponentRouterRoutes): void;
79+
80+
$child: KoComponentRouterInstance;
81+
$parent: KoComponentRouterInstance;
82+
base: string;
83+
ctx: KoComponentRouterContext;
84+
isRoot: boolean;
85+
isNavigating: KnockoutObservable<boolean>;
6986

70-
export function canonicalizePath(path: string): string;
71-
export function get(index: number): KoComponentRouterInstance;
72-
export function getPath(url: string): string;
73-
export function parseUrl(url: string): { hash: string, pathname: string, search: string };
74-
export function sameOrigin(href: string): boolean;
75-
export function setConfig(config: KoComponentRouterConfig): void;
76-
export function update(path: string, push?: boolean): Promise<boolean>;
77-
export function update(path: string, options: { push?: boolean; force?: boolean; with?: any }): Promise<boolean>;
78-
export function use(...middleware: KoComponentRouterMiddleware[]): void;
79-
export function usePlugin(...fns): void;
80-
export function useRoutes(routes: KoComponentRouterRoutes): void;
87+
constructor();
88+
getPathFromLocation(): string;
89+
resolvePath(path): any;
90+
update(path: string, push?: boolean): Promise<boolean>;
8191
}
8292

83-
export = RouterStatic;
93+
export = Router;
8494
}

0 commit comments

Comments
 (0)