https://github.com/GoogleChromeLabs/idlize
Helper classes and methods for implementing the idle-until-urgent pattern
https://github.com/GoogleChromeLabs/idlize
Last synced: 12 months ago
JSON representation
Helper classes and methods for implementing the idle-until-urgent pattern
- Host: GitHub
- URL: https://github.com/GoogleChromeLabs/idlize
- Owner: GoogleChromeLabs
- License: apache-2.0
- Archived: true
- Created: 2018-09-18T15:52:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-29T10:20:47.000Z (almost 3 years ago)
- Last Synced: 2024-10-04T09:26:08.005Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://philipwalton.com/articles/idle-until-urgent/
- Size: 104 KB
- Stars: 1,063
- Watchers: 24
- Forks: 43
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - idlize - until-urgent pattern | GoogleChromeLabs | 968 | (JavaScript)
README
# Idlize
Helper classes and methods make it easier for developers to implement the [*idle-until-urgent*](https://philipwalton.com/articles/idle-until-urgent/) pattern and leverage the [`requestIdleCallback()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback) API.
## Installation
You can install this library from npm by running:
```sh
npm install idlize
```
## Usage
This library is a collection of helper methods and classes (not a single bundle). As such, each helper should be imported separately. All public helpers are released at the level of the project, so they can be imported by directly referencing the helper's `.mjs` file.
```js
import {defineIdleProperty} from 'idlize/defineIdleProperty.mjs'
import {defineIdleProperties} from 'idlize/defineIdleProperties.mjs'
import {cIC, rIC} from 'idlize/idle-callback-polyfills.mjs'
import {IdleQueue} from 'idlize/IdleQueue.mjs'
import {IdleValue} from 'idlize/IdleValue.mjs'
```
Refer to each helper's [documentation](/docs) for examples and API usage details:
- [`defineIdleProperty.mjs`](/docs/defineIdleProperty.md)
- [`defineIdleProperties.mjs`](/docs/defineIdleProperties.md)
- [`idle-callback-polyfills.mjs`](/docs/idle-callback-polyfills.md)
- [`IdleQueue.mjs`](/docs/IdleQueue.md)
- [`IdleValue.mjs`](/docs/IdleValue.md)
## Browser Support

✔

✔

✔

✔

9+

✔
This code has been tested and known to work in all major browsers as well as Internet Explorer back to version 9.
## License
[Apache 2.0](/LICENSE)