# observ-history

> Observable interface to the browser history API

Latest version **1.0.3** (published 2015-11-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install observ-history
pnpm add observ-history
yarn add observ-history
bun add observ-history
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2015-11-04 |
| First published | 2015-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Ben Drucker |
| Maintainers | bendrucker |
| Keywords | observ, observable, history, browser |

## Links

- npm: https://www.npmjs.com/package/observ-history
- Repository: https://github.com/bendrucker/observ-history
- Homepage: https://github.com/bendrucker/observ-history#readme
- Issues: https://github.com/bendrucker/observ-history/issues
- npm.io page: https://npm.io/package/observ-history

## Dependencies (4)

- [geval](https://npm.io/package/geval.md) ~2.1.1
- [global](https://npm.io/package/global.md) ~4.3.0
- [popstate](https://npm.io/package/popstate.md) ~1.0.0
- [document-pathname](https://npm.io/package/document-pathname.md) ~2.0.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2015-11-04
- 1.0.2 — 2015-10-09
- 1.0.1 — 2015-09-24
- 1.0.0 — 2015-09-24

## README

# observ-history [![Build Status](https://travis-ci.org/bendrucker/observ-history.svg?branch=master)](https://travis-ci.org/bendrucker/observ-history)

> Observable interface to the browser history API


## Install

```
$ npm install --save observ-history
```


## Usage

```js
var history = require('observ-history')

history(function (path) {
  //=> (popstate)  
})

history()
//=> current path

history.set(path)
//=> pushState
```

## API

#### `history([listener])` -> `function`

Returns an unlisten function.

##### listener

Type: `function`

A function to call with the current path when the history changes and a [`popstate` event](https://developer.mozilla.org/en-US/docs/Web/Events/popstate) is fired. If no function is passed, the current path is returned.

#### `history.set(path)` -> `undefined`

Updates the history by calling [`pushState`](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState).


## License

MIT © [Ben Drucker](http://bendrucker.me)

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