idle-callback
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

idle-callback

Strongly-typed requestIdleCallback polyfill

import { requestIdleCallback, cancelIdleCallback } from 'idle-callback';
 
const id = requestIdleCallback(
    (deadline: IdleDeadline) => {
        while (deadline.timeRemaining() > 0) {
            // perform some work
        }
    },
    { timeout: 1000 },
);
 
cancelIdleCallback(id);

Package Sidebar

Install

npm i idle-callback

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

4.06 kB

Total Files

5

Last publish

Collaborators

  • iouser