An open API service indexing awesome lists of open source software.

https://github.com/caiogondim/idle-promise.js

requestIdleCallback with a Promise interface and setTimeout fallback
https://github.com/caiogondim/idle-promise.js

Last synced: 3 months ago
JSON representation

requestIdleCallback with a Promise interface and setTimeout fallback

Awesome Lists containing this project

README

        

# idle-promise


Coverage Status Travis CI


`requestIdleCallback` with a Promise interface and `setTimeout` fallback.

## Installation

```bash
npm install --save idle-promise
```

## Usage

### Promise

```js
const idle = require('idle-promise')

idle().then(() => {
// Do somethgin when idle
// ...
})
```

### await

```js
const idle = require('idle-promise')

await idle()

// Do somethgin when idle
// ...
```

## Credits

- Icon created by Adrien Coquet

---

[caiogondim.com](https://caiogondim.com)  · 
GitHub [@caiogondim](https://github.com/caiogondim)  · 
Twitter [@caio_gondim](https://twitter.com/caio_gondim)