# nanoscheduler

> Schedule work to be completed when the browser is idle.

Latest version **1.0.3** (published 2018-03-23) · Apache-2.0 license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-03-23 |
| First published | 2017-12-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | separate (@types/nanoscheduler) |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 44 |
| Maintainers | ahdinosaur, almost, amongiants, bret, colingourlay, emilbayes, feross, freeman-lab, goto-bus-stop, graforlock, jameskyburz, juliangruber, lrlna, maxogden, sethvincent, shama, slaskis, substack, timwis, toddself, tornqvist, ungoldman, yerkopalma, yoshuawuyts |
| Keywords | schedule, request, idle, callback, requestidlecallback, stack, push, singleton |

## Links

- npm: https://www.npmjs.com/package/nanoscheduler
- Repository: https://github.com/choojs/nanoscheduler
- Homepage: https://github.com/choojs/nanoscheduler#readme
- Issues: https://github.com/choojs/nanoscheduler/issues
- npm.io page: https://npm.io/package/nanoscheduler

## Dependencies (1)

- [nanoassert](https://npm.io/package/nanoassert.md) ^1.1.0

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2018-03-23
- 1.0.2 — 2017-12-10
- 1.0.1 — 2017-12-10
- 1.0.0 — 2017-12-10

## README

# nanoscheduler
[![npm version][2]][3] [![build status][4]][5]
[![downloads][8]][9] [![js-standard-style][10]][11]

Schedule work to be completed when the user agent is idle. Weighs 270 bytes
compressed.

## Usage
```js
var NanoScheduler = require('nanoscheduler')

var scheduler = NanoScheduler()
var i = 10000
while (i--) scheduler.push(() => console.log(`idle time! ${Date.now()}`))
```

## Why?
Just like with `window.requestAnimationFrame`, it's much more efficient to
share a single instance than to call it for each piece of work. There's a
significant overhead when scheduling small amounts of work. This package allows
sharing a scheduler as a singleton, which makes it particularly useful to be
shared between multiple applications.

## API
### `scheduler = NanoScheduler()`
Create a new scheduler instance. The instance is shared as a singleton on
`window` (if available).

### `scheduler.push(cb)`
Push a callback into the scheduler, to be executed when the user agent is idle.

## Installation
```sh
$ npm install nanoscheduler
```

## License
[Apache-2.0](./LICENSE)

[0]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square
[1]: https://nodejs.org/api/documentation.html#documentation_stability_index
[2]: https://img.shields.io/npm/v/nanoscheduler.svg?style=flat-square
[3]: https://npmjs.org/package/nanoscheduler
[4]: https://img.shields.io/travis/choojs/nanoscheduler/master.svg?style=flat-square
[5]: https://travis-ci.org/choojs/nanoscheduler
[6]: https://img.shields.io/codecov/c/github/choojs/nanoscheduler/master.svg?style=flat-square
[7]: https://codecov.io/github/choojs/nanoscheduler
[8]: http://img.shields.io/npm/dm/nanoscheduler.svg?style=flat-square
[9]: https://npmjs.org/package/nanoscheduler
[10]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[11]: https://github.com/feross/standard

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