0.0.3 • Published 4 years ago

history-stream v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

history-stream

Streaming routes in typescript

Supports the window.history api with cross-browser support from history

Interfaces

InterfaceUsage
RxjsRouterAn 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
NavigatorAn 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

NameUsage
createRxjsRouterCreates a router connected to the browser through history.createBrowserHistory()
createMockRxjsRouterCreates a mock router that directly pushes routes from its Navigator to its route$
export const createRxjsRouter: () => Router
export const createMockRxjsRouter: () => Router

TODO

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago