Skip to content

hazae41/request-idle-callback-polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

requestIdleCallback polyfill

Polyfill for requestIdleCallback

npm install @hazae41/request-idle-callback-polyfill

📦 NPM

Features

  • ESModules and CommonJS
  • No external dependency
  • Unit-tested
  • requestIdleCallback is polyfilled as setTimeout if not available

Usage

How?

ESModules

import "@hazae41/request-idle-callback-polyfill"

CommonJS

require("@hazae41/request-idle-callback-polyfill")

Where?

You can import the polyfill in your project entry file or in a specific file, you just need to import it before anything that requires requestIdleCallback

(e.g. For a Next.js app, it can be in _app.js)

/**
 * This polyfill at the top
 **/
import "@hazae41/request-idle-callback-polyfill"

/**
 * Your imports that requires requestIdleCallback to work
 **/
import { a } from "a"
import { b } from "./b.js"

/**
 * Your code that requires requestIdleCallback to work
 **/
using x = a

About

Polyfill for requestIdleCallback

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors