@@ -57,28 +57,38 @@ interface KoComponentRouterConfig {
57
57
}
58
58
59
59
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 > ;
69
86
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 > ;
81
91
}
82
92
83
- export = RouterStatic ;
93
+ export = Router ;
84
94
}
0 commit comments