-
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
592 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: npm-history | ||
description: Reatom for npm-history | ||
--- | ||
<!-- THIS FILE WAS AUTOGENERATED --> | ||
<!-- DO NOT EDIT THIS FILE --> | ||
<!-- CHECK "packages/*/README.md" --> | ||
## Installation | ||
|
||
```sh | ||
npm i @reatom/npm-history | ||
``` | ||
|
||
## Usage | ||
|
||
You should setup `historyAtom` in the root of your app, before other dependent atoms will touch the ctx. | ||
|
||
```ts | ||
import { historyAtom } from '@reatom/npm-history' | ||
import { createBrowserHistory } from 'history' | ||
|
||
historyAtom(ctx, createBrowserHistory()) | ||
``` | ||
|
||
```ts | ||
import { History, Location, To, Blocker } from 'history' | ||
|
||
export interface HistoryAtom extends AtomMut<History> { | ||
back: Action<[]> | ||
block: Action<[blocker: Blocker], () => void> | ||
forward: Action<[]> | ||
go: Action<[delta: number]> | ||
location: Atom<Location> | ||
push: Action<[to: To, state?: any]> | ||
replace: Action<[to: To, state?: any]> | ||
} | ||
|
||
export const historyAtom: HistoryAtom | ||
``` |
Oops, something went wrong.