npm.io
0.1.0 • Published 3 years ago

tracked-history

Licence
MIT
Version
0.1.0
Deps
1
Size
59 kB
Vulns
0
Weekly
0

NPM Package

Tracked History

BrowserHistory tracks browser history so that we can restore history stack with snapshots.

It was originally created for Boring Router to support complete lifecycle hooks while keeping browser navigation behavior right.

MemoryHistory and ReadOnlyHistory are also available for testing or server-side usages.

Installation

npm install tracked-history

Usage

import {BrowserHistory} from 'tracked-history';

const history = new BrowserHistory();

const snapshot = history.snapshot;

void history.push('/about');

void history.restore(snapshot);

License

MIT License.