# poll-observer

> observe poll loops

Latest version **2.1.2** (published 2017-01-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install poll-observer
pnpm add poll-observer
yarn add poll-observer
bun add poll-observer
```

## 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 | 2.1.2 |
| Published | 2017-01-27 |
| First published | 2016-12-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Charles Vazac |
| Maintainers | cvazac |
| Keywords | xhr, XMLHttpRequest, async, poll, ajax, callback |

## Links

- npm: https://www.npmjs.com/package/poll-observer
- Repository: https://github.com/cvazac/poll-observer
- Homepage: https://github.com/cvazac/poll-observer#readme
- Issues: https://github.com/cvazac/poll-observer/issues
- npm.io page: https://npm.io/package/poll-observer

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2017-01-27
- 2.1.1 — 2017-01-27
- 2.1.0 — 2017-01-27
- 2.0.0 — 2017-01-27
- 1.0.4 — 2017-01-25
- 1.0.3 — 2017-01-24
- 1.0.2 — 2017-01-18
- 1.0.1 — 2017-01-18
- 1.0.0 — 2016-12-30

## README

# poll-observer

## Intro
`poll-observer` instruments `XMLHttpRequest`, `setTimeout`, `setInterval`, etc. to identify and report common poll loop patterns from the browser.

## Usage
```
var pollObserver = require('poll-observer')
var shouldDisconnect = false
pollObserver.observe(function(data) {
  var entries = data.getEntries()
  entries.forEach(function(entry) {
    console.info('poll entry:', data.pollId, entry.type, entry.url)
  })

  if (shouldDisconnect) {
    pollObserver.disconnect()
  }
})
```

## Example output
```
poll entry: 0 poll http://mysite.com/data.json?reqIndex=0
poll entry: 0 poll http://mysite.com/data.json?reqIndex=1

.... sometime later, maybe ...
poll entry: 0 poll http://mysite.com/data.json?reqIndex=2

.... and even later, maybe ...
poll entry: 0 poll http://mysite.com/data.json?reqIndex=3
```

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