Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@studio-freight/tempus

Package Overview
Dependencies
Maintainers
4
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@studio-freight/tempus

one rAF to rule them all

  • 0.0.37
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

Purpose

Tempus allows you to merge all your requestAnimationFrame (rAF) loops in one for better performance and gives you better control over their execution priority.

Installation

$ npm i @studio-freight/tempus

Usage

import Tempus from '@studio-freight/tempus'

function onFrame(time, deltaTime) {
  // called every frame
}

// subscribe
const unsubscribe = Tempus.add(onFrame, 0)

// unsubscribe
unsubscribe()
// OR
Tempus.remove(onFrame)

Methods

  • add(callback, priority)
  • remove(callback)

Examples

GSAP

gsap.ticker.remove(gsap.updateRoot);
Tempus.add((time) => {
  gsap.updateRoot(time / 1000);
}, 0);

Lenis

Tempus.add((time) => {
  lenis.raf(time)
}, 0);

FAQs

Package last updated on 15 May 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc