Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@horat1us/request-idle-callback
Advanced tools
Readme
Available as commonjs and esm module with typescript typings.
See Using requestIdleCallback
for details.
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.
Includes TypeScript typings and source code.
Using npm:
npm i @horat1us/request-idle-callback
Most common usage:
var handler = require('@horat1us/request-idle-callback')();
/* or */
handler = require('@horat1us/request-idle-callback/polyfill')();
// returns native requestIdleCallback/cancelIdleCallback if compliant
handler.requestIdleCallback;
handler.cancelIdleCallback;
ESM module also available:
import { requestIdleCallback, cancelIdleCallback } from "@horat1us/request-idle-callback"
To shim (replace global) you need to use:
require("@horat1us/request-idle-callback").shim();
// or
require("@horat1us/request-idle-callback/auto");
Or ESM (prefered):
import {shim} from "@horat1us/request-idle-callback/esm";
shim();
You can also use IdlePromise.
Note: Promise support in runtime environment is required
import { IdlePromise, IdlePromiseCancel } from "./src/IdlePromise";
// Create Promise
const promise = IdlePromise({
timeout: 5000,
});
// Process event, handle rejections
promise
.then((deadline) => {
// resolved, same as requestIdleCallback
console.log(deadline)
})
.catch((error) => {
if (error.message === "Idle Promise Cancel") {
// handle cancellation
return;
}
// handle rejection
});
// You can also cancel idleCallack resolving
promise.cancel("Some Reason");
FAQs
Request Idle Callback Polyfill
The npm package @horat1us/request-idle-callback receives a total of 78 weekly downloads. As such, @horat1us/request-idle-callback popularity was classified as not popular.
We found that @horat1us/request-idle-callback demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.