Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
TypeScript definitions for raf
@types/raf is a TypeScript type definition package for the 'raf' library, which provides a polyfill for requestAnimationFrame. This package allows TypeScript developers to use the 'raf' library with type safety.
Polyfill for requestAnimationFrame
This feature provides a polyfill for the requestAnimationFrame function, allowing you to schedule a callback to be called during the next repaint cycle. The code sample demonstrates how to import the 'raf' function and use it to log the timestamp of the animation frame.
import raf from 'raf';
raf((timestamp) => {
console.log(`Animation frame at ${timestamp}`);
});
Cancel animation frame
This feature allows you to cancel a scheduled animation frame callback. The code sample shows how to schedule an animation frame and then cancel it using the 'raf.cancel' method.
import raf from 'raf';
const id = raf((timestamp) => {
console.log(`Animation frame at ${timestamp}`);
});
raf.cancel(id);
The 'requestanimationframe' package provides a polyfill for requestAnimationFrame similar to 'raf'. It also ensures compatibility across different browsers. Compared to '@types/raf', it does not include TypeScript type definitions out of the box.
The 'raf-schd' package is a scheduler for requestAnimationFrame, which helps in debouncing and throttling animations. It provides more advanced scheduling capabilities compared to 'raf', but like 'requestanimationframe', it does not include TypeScript type definitions by default.
npm install --save @types/raf
This package contains type definitions for raf (https://github.com/chrisdickinson/raf#readme).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/raf.
declare const raf: {
(callback: (timestamp: number) => void): number;
cancel: (handle: number) => void;
polyfill: (globalObject?: any) => void;
};
export = raf;
These definitions were written by Ben Lorantfy.
FAQs
TypeScript definitions for raf
We found that @types/raf 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.