File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ /// <reference path="route-recognizer.d.ts" />
2
+
3
+ import RouteRecognizer = require( 'route-recognizer' )
4
+
5
+ var router = new RouteRecognizer < string > ( ) ;
6
+ router . add ( [ { path : "/posts" , handler : "i am the handler" } ] ) ;
7
+ var result = router . recognize ( "/posts" ) ;
Original file line number Diff line number Diff line change
1
+ // Type definitions for route-recognizer
2
+ // Project: https://github.com/tildeio/route-recognizer
3
+ // Definitions by: Dave Keen <http://www.keendevelopment.ch>
4
+ // Definitions: https://github.com/borisyankov/DefinitelyTyped
5
+
6
+ declare module "route-recognizer" {
7
+
8
+ class RouteRecognizer < H > {
9
+ constructor ( )
10
+ add : ( routes : Route < H > [ ] ) => void
11
+ recognize : ( path : string ) => MatchedRoute < H > [ ]
12
+ }
13
+
14
+ interface Route < H > {
15
+ path : string
16
+ handler : H
17
+ }
18
+
19
+ export = RouteRecognizer
20
+ }
21
+
22
+ interface MatchedRoute < H > {
23
+ handler : H
24
+ params : { [ key : string ] : string }
25
+ }
You can’t perform that action at this time.
0 commit comments