# interaction-timeout

> Trigger a timeout when user has not interacted with document for a period of time

Latest version **1.0.3** (published 2015-02-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install interaction-timeout
pnpm add interaction-timeout
yarn add interaction-timeout
bun add interaction-timeout
```

## 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-02-16 |
| First published | 2015-02-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jason Frame |
| Maintainers | jaz303 |
| Keywords | interaction, timeout, screensaver |

## Links

- npm: https://www.npmjs.com/package/interaction-timeout
- Repository: https://github.com/jaz303/interaction-timeout
- Issues: https://github.com/jaz303/interaction-timeout/issues
- npm.io page: https://npm.io/package/interaction-timeout

## Recent versions

- 1.0.3 (latest) — 2015-02-16
- 1.0.2 — 2015-02-16
- 1.0.1 — 2015-02-16
- 1.0.0 — 2015-02-16

## README

# interaction-timeout

`interaction-timeout` creates a timeout object that will call a user-supplied function when the user has not interacted with the document for a given period of time. Useful for creating screensaver and attractors in exhibition/kiosk installations.

Compatibility notes: `interaction-timeout` uses event capturing and is therefore not compatible with IE < 9.

## Install it

    npm install --save interaction-timeout

There's also a UMD build in the `build` directory.

## Require it

	var interactionTimeout = require('interaction-timeout');

If you're using the UMD build the exported symbol is `interactionTimeout`.

## API

#### `var timer = interactionTimeout(fn, delay, [events])`

Create a timer that will call `fn` after `delay` seconds of user inactivity. Newly created timers are idle, that is they will not begin to generate callbacks until either `start()` or `startOnInteraction()` is called.

`events` is an optional list of DOM events which should be considered as user interaction; defaults to `['mousedown', 'touchstart']`.

#### `timer.start()`

Start the timer immediately. The timer's callback will fire after its `delay` has elapsed if no user interaction has occurred in the intervening period. Each user interaction resets the timer, rescheduling it for `delay` milliseconds in the future.

#### `timer.startOnInteraction()`

Schedule the timer to start on the next user interaction. This is useful for attractor screens on exhibits where the user must touch to activate.

#### `timer.stop()`

Stop the timer and prevent the callback from being fired.

## Copyright &amp; License

&copy; 2015 Jason Frame [ [@jaz303](http://twitter.com/jaz303) / [jason@onehackoranother.com](mailto:jason@onehackoranother.com) ]

Released under the ISC license.

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