Skip to content

IOuser/idle-callback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

Strongly-typed requestIdleCallback polyfill

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors