# @pageworks/state-manager

> Manages custom pushState, replaceState, and popstates.

Latest version **1.0.2** (published 2019-04-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @pageworks/state-manager
pnpm add @pageworks/state-manager
yarn add @pageworks/state-manager
bun add @pageworks/state-manager
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-04-29 |
| First published | 2019-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pageworks |
| Maintainers | petertell, codewithkyle |
| Keywords | pushstate, navigation, popstate |

## Links

- npm: https://www.npmjs.com/package/@pageworks/state-manager
- Repository: https://github.com/pageworks/state-manager
- Homepage: https://github.com/pageworks/state-manager#readme
- Issues: https://github.com/pageworks/state-manager/issues
- npm.io page: https://npm.io/package/@pageworks/state-manager

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-04-29

## README

# State Manager

A TypeScript module for building custom pushStates, replaceStates, and popstates.

### Installation

Download State Manager via NPM:

```
npm i --save @pageworks/state-manager
```

Once the package is installed import the package:

```
import Pjax from '@pageworks/state-manager';
```

### Using The State Manager

Start by instantiating a new `StateManager` class with `new StateManager();`. The State Manager class take two optional parameters. First is a boolean for enabling debug mode, by default this value is `false`. The second value is a boolean telling State Manager if an initial `window.replaceState` needs to happen, by default this value is `false`.

The State Manager offers two static functions that can be called to handle the windows push states and replace states.

| Function            | Role                                                                          |
| ------------------- |:----------------------------------------------------------------------------- |
| `doPush`            | Creates a custom state object before calling the `window.pushState` method    |
| `doReplace`         | Creates a custom state object before calling the `window.replaceState` method |

---
_Source: https://npm.io/package/@pageworks/state-manager · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
