0.0.3 • Published 4 years ago
history-stream v0.0.3
history-stream
Streaming routes in typescript
Supports the window.history api with cross-browser support from history
Interfaces
Interface | Usage |
---|---|
RxjsRouter | An Object containing a Navigator , an Observable<string> that pushes out new routes as they occur, and a function to push the current route through the observable |
Navigator | An object with different methods to change the current route. Based on history's navigation interface |
export interface RxjsRouter {
route$: r.Observable<string>;
navigator: Navigator;
pushCurrentRoute: () => void;
}
export interface Navigator {
push: (path: string) => void;
replace: (path: string) => void;
go: (n: number) => void;
goBack: () => void;
goForward: () => void;
}
Functions
Name | Usage |
---|---|
createRxjsRouter | Creates a router connected to the browser through history.createBrowserHistory() |
createMockRxjsRouter | Creates a mock router that directly pushes routes from its Navigator to its route$ |
export const createRxjsRouter: () => Router
export const createMockRxjsRouter: () => Router
TODO
- add leading slashes to routes in mock navigate
- support async iterables
- support @most/core
- support bacon.js
- support xstream
- support kefir
- support highland js