mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Added static method and wrapped in module.
Updated to include static Routie methods. Wrapped types up into a module definition.
This commit is contained in:
Vendored
+28
-10
@@ -3,15 +3,33 @@
|
||||
// Definitions by: Adilson <https://github.com/Adilson>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Route {
|
||||
constructor(path: string, name: string): Route;
|
||||
addHandler(fn: Function): void;
|
||||
removeHandler(fn: Function): void;
|
||||
run(params: any): void;
|
||||
match(path: string, params: any): boolean;
|
||||
toURL(params: any): string;
|
||||
declare module routie {
|
||||
interface Route {
|
||||
constructor(path: string, name: string): Route;
|
||||
addHandler(fn: Function): void;
|
||||
removeHandler(fn: Function): void;
|
||||
run(params: any): void;
|
||||
match(path: string, params: any): boolean;
|
||||
toURL(params: any): string;
|
||||
}
|
||||
|
||||
interface Routie extends RoutieStatic {
|
||||
(path: string): void;
|
||||
(path: string, fn: Function): void;
|
||||
(routes: { [key: string]: Function }): void;
|
||||
}
|
||||
|
||||
interface RoutieStatic {
|
||||
lookup(name: string, fn: Function): string;
|
||||
remove(path: string, fn: Function): void;
|
||||
removeAll(): void;
|
||||
navigate(path: string, options: RouteOptions): void;
|
||||
noConflict(): Routie;
|
||||
}
|
||||
|
||||
interface RouteOptions {
|
||||
silent?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare function routie(path: string): void;
|
||||
declare function routie(path: string, fn: Function): void;
|
||||
declare function routie(routes: { [key: string]: Function }): void;
|
||||
declare var routie: routie.Routie;
|
||||
|
||||
Reference in New Issue
Block a user