# reinterval

> reschedulable setInterval for node.js

Latest version **1.1.0** (published 2016-06-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install reinterval
pnpm add reinterval
yarn add reinterval
bun add reinterval
```

## 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.0 |
| Published | 2016-06-20 |
| First published | 2015-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | 4rzael |
| Maintainers | 4rzael |
| Keywords | node, nodejs, setInterval, retimer, schedule |

## Links

- npm: https://www.npmjs.com/package/reinterval
- Repository: https://github.com/4rzael/reInterval
- Issues: https://github.com/4rzael/reInterval/issues
- npm.io page: https://npm.io/package/reinterval

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-06-20
- 1.0.2 — 2015-11-27
- 1.0.1 — 2015-11-26
- 1.0.0 — 2015-11-26

## README

# reInterval
![TRAVIS](https://travis-ci.org/4rzael/reInterval.svg)

[![NPM](https://nodei.co/npm/reinterval.png?downloads=true&downloadRank=true)](https://nodei.co/npm/reinterval/)

Reschedulable setInterval for node.js.

###### Note: Work highly inspired by [mcollina](https://github.com/mcollina)'s [retimer](https://github.com/mcollina/retimer).

## Example

```js
var reInterval = require('reInterval');

var inter = reInterval(function () {
  console.log('this should be called after 13s');
}, 10 * 1000);

// This will reset/reschedule the interval after 3 seconds, therefore
// the interval callback won't be called for at least 13 seconds.
setTimeout(function () {
  inter.reschedule(10 * 1000);
}, 3 * 1000);
```


## API:

###`reInterval(callback, interval[, param1, param2, ...])`

This is exactly like setInterval.

_Arguments:_
  - `callback`: The callback to be executed repeatedly.
  - `interval`: The number of milliseconds (thousandths of a second) that the `reInterval()` function should wait before each call to `callback`.
  - `param1, param2, ...`: *(OPTIONAL)* These arguments are passed to the `callback` function.

####returns an `interval` object with the following methods:

###`interval.reschedule([interval])`

This function resets the `interval` and restarts it now.

_Arguments:_
  - `interval`: *(OPTIONAL)* This argument can be used to change the amount of milliseconds to wait before each call to the `callback` passed to the `reInterval()` function.

###`interval.clear()`

This function clears the interval. Can be used to temporarily clear the `interval`, which can be rescheduled at a later time.

###`interval.destroy()`

This function clears the interval, and will also clear the `callback` and `params` passed to reInterval, so calling this essentially just makes this object ready for overwriting with a new `interval` object. 

#### Note:
Please ensure that either the `interval.clear()` or `interval.destroy()` function is called before overwriting the `interval` object, because the internal `interval` can continue to run in the background unless cleared.

## license

**MIT**

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