# detect-lingering

> Tiny utility for detecting when a user lingers, e.g. if they pause or slow down to look at something while scrolling

Latest version **1.1.1** (published 2018-08-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install detect-lingering
pnpm add detect-lingering
yarn add detect-lingering
bun add detect-lingering
```

## 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.1.1 |
| Published | 2018-08-10 |
| First published | 2017-07-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alan Clarke |
| Maintainers | alz |

## Links

- npm: https://www.npmjs.com/package/detect-lingering
- Repository: https://github.com/alanclarke/detect-lingering
- Homepage: https://github.com/alanclarke/detect-lingering#readme
- Issues: https://github.com/alanclarke/detect-lingering/issues
- npm.io page: https://npm.io/package/detect-lingering

## Recent versions

- 1.1.1 (latest) — 2018-08-10
- 1.1.0 — 2017-07-10
- 1.0.2 — 2017-07-10
- 1.0.1 — 2017-07-07
- 1.0.0 — 2017-07-07

## README

# detect-lingering
Tiny utility for detecting when a user lingers, e.g. if they pause or slow down to look at something while scrolling

## installation
```js
npm install detect-lingering
```

## usage
```js
function onLinger () {
  console.log('user is lingering!')
}

var detector = createLingerDetector(onLinger, options)

el.onscroll = function () {
  // any actual calculations are deferred to a set interval
  // detector is very light method, and can be used in the scroll handler
  detector.update(el.scrollTop)
}
```

## methods
- update: call this every time your value changes, e.g. scrollTop. Detector uses this to detect lingering
- stop: call this to stop any scheduled calculations

## options
- speed: 0.1 // speed below which we consider the user to be lingering
- time: 400 // time the user has to linger for in order for the linger to count
- timeout: 2000 // how long to keep monitoring for changes after the last change
- interval: 50 // how frequently to monitor for changes

## demo

```js
npm run demo
```

## run tests
` npm test `

[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)

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