
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
A very limited subset of requestAnimationFrame functions I use every day
npm i raf-funcs
Package on npm
Debounce a function, based on requestAnimationFrame
| Argument | Action |
|---|---|
| cb | the callback |
| delay | optional delay, default to 300 ms, min to 25 ms |
| ctx | optional context of this, default to global |
Return a reference with
immediate and cancelconst debounce = require('raf-funcs/debounce')
var debounced = debounce(function() {
console.log('250 ms after the last keyup')
}, 250)
input.addEventListener('keyup', debounced)
// uncomment to cancel the debounce
// debounced.cancel()
// uncomment to call it immediately
// debounced.immediate()
Like setInterval but based on requestAnimationFrame
| Argument | Action |
|---|---|
| cb | the callback |
| delay | optional delay, default to 0 ms |
| ctx | optional context of this, default to global |
| count | optional maximum call, default to Infinity |
Return a reference with
startedstart and cancelconst interval = require('raf-funcs/interval')
var ref = interval(function() {
console.log('every second')
}, 1000)
// true
ref.started
// uncomment to cancel the interval
// ref.cancel()
// uncomment to restart the interval (if finished or canceled)
// ref.start()
The callback cb receive two arguments
| Argument | Action |
|---|---|
| elapsed | the elapsed time since the start |
| step | the step count |
const interval = require('raf-funcs/interval')
// elapsed: 1010 step: 1
// elapsed: 2011 step: 2
// elapsed: 3014 step: 3
interval(function(elapsed, step) {
console.log('elapsed:', elapsed, 'step:', step)
}, 1000, null, 3)
Throttle a function, based on requestAnimationFrame
| Argument | Action |
|---|---|
| cb | the callback |
| delay | optional delay, default to 50 ms, min to 25 ms |
| ctx | optional context of this, default to global |
Return a reference with
immediate and cancelconst throttle = require('raf-funcs/throttle')
var throttled = throttle(function() {
console.log('after the first resize, then after each 250 ms elapsed')
}, 250)
window.addEventListener('resize', throttled)
// uncomment to cancel the throttle
// throttled.cancel()
// uncomment to call it immediately
// throttled.immediate()
Like setTimeout but based on requestAnimationFrame
| Argument | Action |
|---|---|
| cb | the callback |
| delay | optional delay, default to 0 ms |
| ctx | optional context of this, default to global |
Return a reference with
startedstart and cancelconst timeout = require('raf-funcs/timeout')
var ref = timeout(function() {
console.log('1 second later')
}, 1000)
// true
ref.started
// uncomment to cancel the timeout
// ref.cancel()
// uncomment to restart the timeout (if finished or canceled)
// ref.start()
The callback cb receive one argument
| Argument | Action |
|---|---|
| elapsed | the elapsed time since the start |
const timeout = require('raf-funcs/timeout')
// elapsed: 1006
timeout(function(elapsed) {
console.log('elapsed:', elapsed)
}, 1000)
Mainly forked / inspired on
Performance tips from
MIT
FAQs
A very limited subset of requestAnimationFrame functions I use every day
The npm package raf-funcs receives a total of 28 weekly downloads. As such, raf-funcs popularity was classified as not popular.
We found that raf-funcs 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.