ofHistory

import { history } from '@hullo/browser'

Adapter for window.history for Hullo. ofHistory is duplex meaning it is both observable and observer. Observable part allows reacting to history state / url observation. Observer part allows manipulation of history.

import { ofHistory } from '@hullo/browser';
import { createBrowserHistory } from 'history';
const history = createBrowserHistory({});
const history$ = ofHistory<{ q: number }>(history);
history$
.subscribe({
next({ state, pathname }) {
console.log({ state, href: pathname });
}
});
history$.next({ pathname: '/path' });