
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
Various implementations of game loops. Most of which I have implemented at one time or another. I grow weary of rewriting this code. Here it is for viewing or usage. There are tests too. If you want detail explanation on why you may want one over another read Fix your timestep by Glenn Fielder.
import {
createFixedDeltaTime,
createVariableDeltaTime,
createSemiFixedTimestep,
createFixedTimeStep,
createFixedTimeStepWithRemainder
} from 'game-loops';
const ms = 1000 / 60;
const onFrame = (Δ, t) => { ... };
const onRemainder = (Δ, t) => { ... };
const isPaused = () => false;
const fixedDeltaTime = createFixedDeltaTime(ms, isPaused, onFrame);
const variableDeltaTime = createVariableDeltaTime(isPaused, onFrame);
const semiFixedTimeStep = createSemiFixedTimestep(ms, isPaused, onFrame);
const fixedTimeStep = createFixedTimeStep(ms, isPaused, onFrame);
const withRemainder = createFixedTimeStepWithRemainder(ms, isPaused, onFrame, onRemainder);
setInterval(fixedDeltaTime, 1000 / 60);
setInterval(variableDeltaTime, 1000 / 60);
setInterval(semiFixedTimeStep, 1000 / 60);
setInterval(fixedTimeStep, 1000 / 60);
setInterval(withRemainder, 1000 / 60);
or you can call it on demand
fixedDeltaTime();
variableDeltaTime();
semiFixedTimeStep();
fixedTimeStep();
withRemainder();
Calls your function with a fixed time delta everytime you invoke it. You could probably just do this yourself.
Calculates time between invocations and uses that as the delta.
As variable but caps it at a delta you define.
Set the timestep to some number of milliseconds. Say 1000/60 for 60 frames per second. This means that the callback will always receive the timestep specified on frame. Will call your function frameDelta / ms times
Accepts an optional final parameter to limit the frameDelta to some number of ms.
const fixedTimeStep = createFixedTimeStep(ms, isPaused, onFrame, maxMS);
Like fixed timestep but your onRemainder function is called with the remainder of ms. You can determine how far through a frame you are to render the world. It's up to you. Will call your function frameDelta / ms times.
Accepts an optional final parameter to limit the frameDelta to some number of ms.
const withRemainder = createFixedTimeStepWithRemainder(ms, isPaused, onFrame, onRemainder, maxMS);
FAQs
Several kinds of game loop
We found that game-loops 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.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.