
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
tempus means time in Latin, this package is a lightweight, high-performance animation frame manager for JavaScript applications.
using package manager
npm install tempus
import Tempus from 'tempus'
using script tag
<script src="https://unpkg.com/tempus@1.0.0-dev.11/dist/tempus.min.js"></script>
import Tempus from "tempus"
// Simple animation at maximum FPS
function animate(time, deltaTime) {
console.log('frame', time, deltaTime)
}
Tempus.add(animate)
const unsubscribe = Tempus.add(animate)
unsubscribe()
Tempus.pause() // no rafs will be called
Tempus.play() // resume
Tempus.restart() // set clock elapsed time to 0
See tempus/react
Tempus.add(animate, {
fps: 30 // Will run at 30 FPS
})
Tempus.add(animate, {
fps: '50%' // Will run at 50% of the system's FPS
})
——[-Infinity]——[0]——[Infinity]——> execution order
// Default priority: 0 (runs second)
Tempus.add(() => console.log('animate'))
// Priority: 1 (runs third)
Tempus.add(() => console.log('render'), { priority: 1 })
// Priority: -1 (runs first)
Tempus.add(() => console.log('scroll'), { priority: -1 })
scroll
animate
render
// Patch native requestAnimationFrame across all your app
Tempus.patch()
// Now any requestAnimationFrame recursive calls will use Tempus
let framesCount = 0
// ping and pong will run at 50% of the system's FPS,
// but never during the same frame
Tempus.add(() => {
if (framesCount === 0) {
console.log('ping')
} else {
console.log('pong')
}
framesCount++
framesCount %= 2
})
Tempus.add(lenis.raf)
// Remove GSAP's internal RAF
gsap.ticker.remove(gsap.updateRoot)
// Add to Tempus
Tempus.add((time) => {
gsap.updateRoot(time / 1000)
})
Tempus.add(() => {
renderer.render(scene, camera)
}, { priority: 1 })
// the render will happen after other rafs
// so it can be synched with lenis for instance
Adds an animation callback to the loop.
(time: number, deltaTime: number) => voidpriority: number (default: 0) - Lower numbers run firstfps: number (default: Infinity) - Target frame rate() => void - Unsubscribe functionPatches the native requestAnimationFrame to use Tempus.
Unpatches the native requestAnimationFrame to use the original one.
MIT © darkroom.engineering
Thank you to Keith Cirkel for having transfered us the npm package name 🙏.
FAQs
one rAF to rule them all
We found that tempus demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.