Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vilicvane/tracked-history
It tracks browser history so that we can restore history stack with snapshots.
https://github.com/vilicvane/tracked-history
Last synced: 20 days ago
JSON representation
It tracks browser history so that we can restore history stack with snapshots.
- Host: GitHub
- URL: https://github.com/vilicvane/tracked-history
- Owner: vilicvane
- License: mit
- Created: 2023-02-09T16:57:59.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-09T18:00:46.000Z (almost 2 years ago)
- Last Synced: 2024-11-30T15:42:02.330Z (23 days ago)
- Language: TypeScript
- Homepage:
- Size: 41 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![NPM Package](https://badge.fury.io/js/tracked-history.svg)](https://www.npmjs.com/package/tracked-history)
# Tracked History
`BrowserHistory` tracks browser history so that we can restore history stack with snapshots.
> It was originally created for [Boring Router](https://github.com/makeflow/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
```sh
npm install tracked-history
```## Usage
```ts
import {BrowserHistory} from 'tracked-history';const history = new BrowserHistory();
const snapshot = history.snapshot;
void history.push('/about');
void history.restore(snapshot);
```## License
MIT License.