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
- Host: GitHub
- URL: https://github.com/caiogondim/idle-promise.js
- Owner: caiogondim
- License: mit
- Created: 2017-11-01T16:02:11.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-13T22:31:50.000Z (about 7 years ago)
- Last Synced: 2025-01-24T18:08:33.878Z (5 months ago)
- Language: JavaScript
- Homepage: https://npm.im/idle-promise
- Size: 121 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# idle-promise
`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)