|
| 1 | +declare module FOS { |
| 2 | + export interface RouteDefaults { |
| 3 | + [index:string]:string; |
| 4 | + } |
| 5 | + |
| 6 | + export interface RouteRequirements { |
| 7 | + [index:string]:string; |
| 8 | + } |
| 9 | + |
| 10 | + export interface RouteParams { |
| 11 | + [index:string]:any; |
| 12 | + } |
| 13 | + |
| 14 | + export interface QueryParamAddFunction { |
| 15 | + (prefix:string,params:any):void; |
| 16 | + } |
| 17 | + |
| 18 | + export interface Route { |
| 19 | + tokens:string[][]; |
| 20 | + defaults:RouteDefaults; |
| 21 | + requirements:RouteRequirements; |
| 22 | + hosttokens:string[]; |
| 23 | + } |
| 24 | + |
| 25 | + export interface RoutesMap { |
| 26 | + [index:string]:Route; |
| 27 | + } |
| 28 | + |
| 29 | + export interface Context { |
| 30 | + base_url:string; |
| 31 | + } |
| 32 | + |
| 33 | + export interface Router { |
| 34 | + new(opt_context?:Context, opt_routes?:RoutesMap):Router; |
| 35 | + setRoutes(routes:RoutesMap):void; |
| 36 | + getRoutes():RoutesMap; |
| 37 | + setBaseUrl(base_url:string):void; |
| 38 | + getBaseUrl():string; |
| 39 | + setPrefix(prefix:string):void; |
| 40 | + setScheme(scheme:string):void; |
| 41 | + getScheme():string; |
| 42 | + setHost(host:string):void; |
| 43 | + getHost():string; |
| 44 | + |
| 45 | + /** |
| 46 | + * Builds query string params added to a URL. |
| 47 | + * Port of jQuery's $.param() function, so credit is due there. |
| 48 | + */ |
| 49 | + buildQueryParams(prefix:string,params:any,add:QueryParamAddFunction):void; |
| 50 | + |
| 51 | + /** |
| 52 | + * Returns a raw route object. |
| 53 | + */ |
| 54 | + getRoute(name:string):Route; |
| 55 | + |
| 56 | + /** |
| 57 | + * Generates the URL for a route. |
| 58 | + */ |
| 59 | + generate(name:string,opt_params?:RouteParams,absolute?:boolean):string; |
| 60 | + } |
| 61 | +} |
| 62 | + |
| 63 | +declare var Routing:FOS.Router; |
0 commit comments