A polyfill for `window.requestIdleCallback`, support NodeJs. It can be used for time slicing
npm install @livelybone/request-idle-callbackA polyfill for window.requestIdleCallback, support NodeJs. It can be used for time slicing.
The behavior of this module is closer to window.requestIdleCallback
than requestidlecallback, see the details in the example below
1. Clone the library git clone https://github.com/livelybone/request-idle-callback.git
2. Go to the directory cd your-module-directory
3. Install npm dependencies npm i(use taobao registry: npm i --registry=http://registry.npm.taobao.org)
4. Open service npm run dev
5. See the example(usually is http://127.0.0.1:3000/examples/test.html) in your browser
bash
npm i -S @livelybone/request-idle-callback
`Global name - The variable the module exported in
umd bundle
RICInterface
See what method or params you can use in index.d.tsUsage
`js
import * as RIC from '@livelybone/request-idle-callback'const id = RIC.requestIdleCallback(() => {
// ... do something
})
RIC.cancelIdleCallback(id)
`$3
> in js:
`js
import '@livelybone/request-idle-callback/lib/umd/polyfill';
`> in html(CDN):
`html
`CDN
Use in html, see what you can use in CDN: unpkg
`html
<-- use what you want -->
`Or,see what you can use in CDN: jsdelivr
`html
``