Created
February 16, 2015 23:47
-
-
Save JLarky/a57b4bcc2b506eaf3d8a to your computer and use it in GitHub Desktop.
routerecognizer typescrip type definitions (incomplete)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Type definitions for RouteRecognizer 0.1.4 | |
// Project: https://github.com/tildeio/route-recognizer | |
declare class RouteRecognizer { | |
add(routes: Object[], options?: Object): void; | |
map(callback: RouteRecognizer.Callback): void; | |
recognize(path: string): RouteRecognizer.Result; | |
} | |
declare module RouteRecognizer { | |
interface Params { | |
[key: string]: string | |
} | |
export interface Result extends Array<Handler> { | |
queryParams: Params; | |
} | |
export interface Handler { | |
handler: any; | |
params: Params; | |
isDynamic: boolean | |
} | |
// route-recognizer/dsl.js | |
interface Callback { | |
(e: Match): void; | |
} | |
export interface Match { | |
(path: string): Target; | |
(path: string, e: Callback): Target; | |
} | |
export interface Target { | |
to(handler: string): void; | |
to(handler: Function): void; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment