Skip to content

Commit

Permalink
Update doc links to master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson committed Jun 12, 2020
1 parent 987ff43 commit 9930845
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 64 deletions.
38 changes: 11 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,32 @@
[build-badge]: https://img.shields.io/travis/ReactTraining/history/master.svg?style=flat-square
[build]: https://travis-ci.org/ReactTraining/history

The history library lets you easily manage session history anywhere JavaScript
runs. A `history` object abstracts away the differences in various environments
and provides a minimal API that lets you manage the history stack, navigate, and
persist state between sessions.
The history library lets you easily manage session history anywhere JavaScript runs. A `history` object abstracts away the differences in various environments and provides a minimal API that lets you manage the history stack, navigate, and persist state between sessions.

## Documentation

Documentation for the current branch can be found in the [docs](docs) directory.
Documentation for version 5 can be found in the [docs](docs) directory. This is the current stable release. Version 5 is used in React Router version 6.

Documentation for version 4 can be found [on the v4 branch](https://github.com/ReactTraining/history/tree/v4/docs). Version 4 is used in React Router versions 4 and 5.

## Changes

To see the changes that were made in a given release, please lookup the tag on
[the releases page](https://github.com/ReactTraining/history/releases).
To see the changes that were made in a given release, please lookup the tag on [the releases page](https://github.com/ReactTraining/history/releases).

For changes released in version 4.6.3 and earlier, please see [the `CHANGES.md`
file](https://github.com/ReactTraining/history/blob/845d690c5576c7f55ecbe14babe0092e8e5bc2bb/CHANGES.md).
For changes released in version 4.6.3 and earlier, please see [the `CHANGES.md` file](https://github.com/ReactTraining/history/blob/845d690c5576c7f55ecbe14babe0092e8e5bc2bb/CHANGES.md).

## Development

Development of the current stable release, version 4, happens on [the `master`
branch](https://github.com/ReactTraining/history/tree/master). Please keep in
mind that this branch may include some work that has not yet been published as
part of an official release. However, since `master` is always stable, you
should feel free to build your own working release straight from master at any
time.

Development of the next major release, version 5, happens on [the `dev`
branch](https://github.com/ReactTraining/history/tree/dev).
Development of the current stable release, version 5, happens on [the `master` branch](https://github.com/ReactTraining/history/tree/master). Please keep in mind that this branch may include some work that has not yet been published as part of an official release. However, since `master` is always stable, you should feel free to build your own working release straight from master at any time.

If you're interested in helping out, please read [our contributing
guidelines](CONTRIBUTING.md).
If you're interested in helping out, please read [our contributing guidelines](CONTRIBUTING.md).

## About

`history` is developed and maintained by [React Training](https://reacttraining.com). If
you're interested in learning more about what React can do for your company, please
[get in touch](mailto:[email protected])!
`history` is developed and maintained by [React Training](https://reacttraining.com). If you're interested in learning more about what React can do for your company, please [get in touch](mailto:[email protected])!

## Thanks

A big thank-you to [BrowserStack](https://www.browserstack.com/) for providing
the infrastructure that allows us to run our build in real browsers.
A big thank-you to [BrowserStack](https://www.browserstack.com/) for providing the infrastructure that allows us to run our build in real browsers.

Also, thanks to [Dan Shaw](https://www.npmjs.com/~dshaw) for letting us use the
`history` npm package name. Thanks, Dan!
Also, thanks to [Dan Shaw](https://www.npmjs.com/~dshaw) for letting us use the `history` npm package name. Thanks, Dan!
4 changes: 2 additions & 2 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ If you're building a link, you'll want to use [`history.createHref`](#history.cr

## Reference

The [source code](https://github.com/ReactTraining/history/tree/dev/packages/history) for the history library is written in TypeScript, but it is compiled to JavaScript before publishing. Some of the function signatures in this reference include their TypeScript type annotations, but you can always refer to the original source as well.
The [source code](https://github.com/ReactTraining/history/tree/master/packages/history) for the history library is written in TypeScript, but it is compiled to JavaScript before publishing. Some of the function signatures in this reference include their TypeScript type annotations, but you can always refer to the original source as well.

<a name="action"></a>

### Action

An [`Action`](https://github.com/ReactTraining/history/blob/0f992736/packages/history/index.ts#L4) represents a type of change that occurred in the history stack. `Action` is an `enum` with three members:
An `Action` represents a type of change that occurred in the history stack. `Action` is an `enum` with three members:

- <a name="action.pop"></a> `Action.Pop` - A change to an arbitrary index in the stack, such as a back or forward navigation. This does not describe the direction of the navigation, only that the index changed. This is the default action for newly created history objects.
- <a name="action.push"></a> `Action.Push` - Indicates a new entry being added to the history stack, such as when a link is clicked and a new page loads. When this happens, all subsequent entries in the stack are lost.
Expand Down
70 changes: 35 additions & 35 deletions packages/history/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Actions represent the type of change to a location value.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#action
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#action
*/
export enum Action {
/**
Expand Down Expand Up @@ -30,37 +30,37 @@ export enum Action {
/**
* A URL pathname, beginning with a /.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.pathname
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.pathname
*/
export type Pathname = string;

/**
* A URL search string, beginning with a ?.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.search
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.search
*/
export type Search = string;

/**
* A URL fragment identifier, beginning with a #.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.hash
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.hash
*/
export type Hash = string;

/**
* An object that is used to associate some arbitrary data with a location, but
* that does not appear in the URL path.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.state
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.state
*/
export type State = object | null;

/**
* A unique string associated with a location. May be used to safely store
* and retrieve data in some other storage API, like `localStorage`.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.key
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.key
*/
export type Key = string;

Expand All @@ -71,21 +71,21 @@ export interface Path {
/**
* A URL pathname, beginning with a /.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.pathname
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.pathname
*/
pathname: Pathname;

/**
* A URL search string, beginning with a ?.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.search
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.search
*/
search: Search;

/**
* A URL fragment identifier, beginning with a #.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.hash
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.hash
*/
hash: Hash;
}
Expand All @@ -94,13 +94,13 @@ export interface Path {
* An entry in a history stack. A location contains information about the
* URL path, as well as possibly some arbitrary state and a key.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location
*/
export interface Location<S extends State = State> extends Path {
/**
* An object of arbitrary data associated with this location.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.state
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.state
*/
state: S;

Expand All @@ -110,7 +110,7 @@ export interface Location<S extends State = State> extends Path {
*
* Note: This value is always "default" on the initial location.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.key
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.key
*/
key: Key;
}
Expand All @@ -122,21 +122,21 @@ export interface PartialPath {
/**
* The URL pathname, beginning with a /.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.pathname
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.pathname
*/
pathname?: Pathname;

/**
* The URL search string, beginning with a ?.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.search
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.search
*/
search?: Search;

/**
* The URL fragment identifier, beginning with a #.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.hash
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.hash
*/
hash?: Hash;
}
Expand All @@ -148,7 +148,7 @@ export interface PartialLocation<S extends State = State> extends PartialPath {
/**
* An object of arbitrary data associated with this location.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.state
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.state
*/
state?: S;

Expand All @@ -158,7 +158,7 @@ export interface PartialLocation<S extends State = State> extends PartialPath {
*
* Note: This value is always "default" on the initial location.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#location.key
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#location.key
*/
key?: Key;
}
Expand Down Expand Up @@ -223,14 +223,14 @@ export interface History<S extends State = State> {
* The last action that modified the current location. This will always be
* Action.Pop when a history instance is first created. This value is mutable.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.action
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.action
*/
readonly action: Action;

/**
* The current location. This value is mutable.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.location
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.location
*/
readonly location: Location<S>;

Expand All @@ -240,7 +240,7 @@ export interface History<S extends State = State> {
*
* @param to - The destination URL
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.createHref
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.createHref
*/
createHref(to: To): string;

Expand All @@ -252,7 +252,7 @@ export interface History<S extends State = State> {
* @param to - The new URL
* @param state - Data to associate with the new location
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.push
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.push
*/
push(to: To, state?: S): void;

Expand All @@ -263,7 +263,7 @@ export interface History<S extends State = State> {
* @param to - The new URL
* @param state - Data to associate with the new location
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.replace
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.replace
*/
replace(to: To, state?: S): void;

Expand All @@ -273,7 +273,7 @@ export interface History<S extends State = State> {
*
* @param delta - The delta in the stack index
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.go
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.go
*/
go(delta: number): void;

Expand All @@ -283,14 +283,14 @@ export interface History<S extends State = State> {
* Warning: if the current location is the first location in the stack, this
* will unload the current document.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.back
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.back
*/
back(): void;

/**
* Navigates to the next entry in the stack. Identical to go(1).
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.forward
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.forward
*/
forward(): void;

Expand All @@ -301,7 +301,7 @@ export interface History<S extends State = State> {
* @param listener - A function that will be called when the location changes
* @returns unlisten - A function that may be used to stop listening
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.listen
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.listen
*/
listen(listener: Listener<S>): () => void;

Expand All @@ -312,7 +312,7 @@ export interface History<S extends State = State> {
* @param blocker - A function that will be called when a transition is blocked
* @returns unblock - A function that may be used to stop blocking
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#history.block
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#history.block
*/
block(blocker: Blocker<S>): () => void;
}
Expand All @@ -322,7 +322,7 @@ export interface History<S extends State = State> {
* browser environment. This is the standard for most web apps and provides the
* cleanest URLs the browser's address bar.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#browserhistory
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#browserhistory
*/
export interface BrowserHistory<S extends State = State> extends History<S> {}

Expand All @@ -335,7 +335,7 @@ export interface BrowserHistory<S extends State = State> extends History<S> {}
* shared hosting environments that do not provide fine-grained controls over
* which pages are served at which URLs.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#hashhistory
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#hashhistory
*/
export interface HashHistory<S extends State = State> extends History<S> {}

Expand All @@ -344,7 +344,7 @@ export interface HashHistory<S extends State = State> extends History<S> {}
* environments where there is no web browser, such as node tests or React
* Native.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#memoryhistory
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#memoryhistory
*/
export interface MemoryHistory<S extends State = State> extends History<S> {
index: number;
Expand Down Expand Up @@ -392,7 +392,7 @@ export type BrowserHistoryOptions = { window?: Window };
* most web apps, but it requires some configuration on the server to ensure you
* serve the same app at multiple URLs.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#createbrowserhistory
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#createbrowserhistory
*/
export function createBrowserHistory(
options: BrowserHistoryOptions = {}
Expand Down Expand Up @@ -611,7 +611,7 @@ export type HashHistoryOptions = { window?: Window };
* some reason, either because you do cannot configure it or the URL space is
* reserved for something else.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#createhashhistory
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#createhashhistory
*/
export function createHashHistory(
options: HashHistoryOptions = {}
Expand Down Expand Up @@ -877,7 +877,7 @@ export type MemoryHistoryOptions = {
* Memory history stores the current location in memory. It is designed for use
* in stateful non-browser environments like tests and React Native.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#creatememoryhistory
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#creatememoryhistory
*/
export function createMemoryHistory(
options: MemoryHistoryOptions = {}
Expand Down Expand Up @@ -1073,7 +1073,7 @@ function createKey() {
/**
* Creates a string URL path from the given pathname, search, and hash components.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#createpath
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#createpath
*/
export function createPath({
pathname = '/',
Expand All @@ -1086,7 +1086,7 @@ export function createPath({
/**
* Parses a string URL path into its separate pathname, search, and hash components.
*
* @see https://github.com/ReactTraining/history/tree/dev/docs/api-reference.md#parsepath
* @see https://github.com/ReactTraining/history/tree/master/docs/api-reference.md#parsepath
*/
export function parsePath(path: string) {
let partialPath: PartialPath = {};
Expand Down

0 comments on commit 9930845

Please sign in to comment.