0.0.37 • Published 5 years ago
rxjs-first-router v0.0.37
rxjs-first-router
A simpler, mockable take on redux-first-router using reactive streams
Interfaces
Interface | Usage |
---|---|
Router | 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 Router {
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 |
---|---|
createRouter | Creates a router connected to the browser through history.createBrowserHistory() |
createMockRouter | Creates a mock router that directly pushes routes from its Navigator to its route$ |
export const createRouter: () => Router
export const createMockRouter: () => Router