Cycle-Director
This is a first attempt a making a router driver for cycle.js using director
Install
npm install cycle-director
Client Example
;; ; let { return "author" };let { return "books"};let {return "viewBook: bookId is populated: " + id};let { return "BookId: " + bookId + " Chapter: " + chapterNumber} let routes = url: "/author" on: author {if ! windowlocationhash = '#/author' } url: "/books" on: books { return "An inline route handler"} url: "/books/view/:bookId" on: viewBook url: "/books/view/:bookId/chapter/:chapterNumber" on: viewChapter { return } { let route$ = RxObservable; let view$ = Router return DOM: view$ Router: route$ ;} let drivers = DOM: Router: ; ;
API
makeRouterDriver(options)
Arguments
options - options are all configuration options supported by director
Return
(Function) The Router Driver function. It expects an Observable of Route Objects as input, and outputs the path of the current route.
Route Object
- url (required): path to mount routing events
- optionally any routing event director supports
Server Side Example
cycle-http-server
Uses;;; { thisres; thisres;} let routes = "/hello": get: helloWorld ; { Server