Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
update: (v: number) => {
prev = current;
current = v;
lastUpdateTimestamp = currentFrameTime();
observer.update(v);
}
};
getVelocity: () => {
const frame = currentFrameTime();
const frameDelta = timeSinceLastFrame();
return (frame - lastUpdateTimestamp <= frameDelta)
? speedPerSecond(current - prev, frameDelta)
: 0;
},
update: (v: number) => {