New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@dandre3000/fixed-time-step

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dandre3000/fixed-time-step

Call a function on a fixed interval over a variable timespan.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

fixed-time-step

Call a function on a fixed interval over a variable timespan.

Installation

npm i @dandre3000/fixed-time-step

Usage

import { FixedTimeStep } from '@dandre3000/fixed-time-step'

const fts = new FixedTimeStep(1000 / 60, (t, ...args) => {
    console.log(t, elapsedTime, i, ...args) // 1000 / 60, ...

    elapsedTime += t
    i++
})

let time = performance.now()
let elapsedTime = 0
let i = 0

setInterval(() => {
    const dt = performance.now() - time

    fts.step(dt, { args: ['YOOO'] })
    time = performance.now()
})

Exports

interface StepOptions {
 args: boolean
 self: boolean
}

Class FixedTimeStep

constructor (interval: number, callback: (...args: any[]) => void)

Instance

interval: number

callback: (...args: any[]) => void

step (time: number, options?: StepOptions) => number

License

MIT

Keywords

timer

FAQs

Package last updated on 21 Mar 2026

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