core-timing

Provide deterministic logical-time scheduling for JavaScript/TypeScript applications.

4|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/AvneeshSarwate/avTools --skill core-timing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: core-timing
Source: https://github.com/AvneeshSarwate/avTools/tree/main/skills/core-timing
Command: npx skills add https://github.com/AvneeshSarwate/avTools --skill core-timing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Deterministic, drift-free timing engine for JavaScript/TypeScript. It provides logical-time scheduling with structured concurrency, enabling precise control over when waits resolve and avoiding wall-clock drift.

Core Features & Use Cases

  • Deterministic logical-time scheduling with TimeContext and a drift-free base time.
  • Structured concurrency via branch() and branchWait() with join semantics.
  • Dual execution modes: realtime (setTimeout/RAF) and offline (step-based) for reproducible testing.
  • Beat-aware tempo with TempoMap and BPM ramping support.
  • Deterministic RNG per context for reproducible randomness.
  • Barrier primitives and priority queue-based scheduling for scalable coordination.

Quick Start

Use the library to start a realtime root context and wait for 1 second of logical time. Then cancel if needed.

Frequently Asked Questions about core-timing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent timing drift in JavaScript realtime animation loops?

You prevent timing drift by using a deterministic, logical-time scheduling engine that provides a drift-free base time for JavaScript applications. This ensures precise control over when waits resolve in realtime animation loops.

What is deterministic logical-time scheduling in TypeScript?

Deterministic logical-time scheduling coordinates multiple tasks on a shared timeline using a TempoMap and structured concurrency. It ensures waits resolve predictably without wall-clock drift in TypeScript applications.

Can I use deterministic scheduling for offline rendering in Deno?

Yes, you can use deterministic scheduling for offline rendering. The engine supports an offline step-based execution mode alongside realtime execution, enabling reproducible testing and rendering in Deno environments.

How do I coordinate multiple concurrent tasks on a shared timeline?

You coordinate multiple concurrent tasks using structured concurrency primitives like branch() and branchWait() with join semantics. These barrier primitives use priority queue-based scheduling for scalable coordination on a shared timeline.

Does this timing engine support beat-based tempo and BPM ramping?

Yes, the timing engine supports beat-aware tempo through a TempoMap. You can use setBpm and rampBpmTo APIs to control musical timing and smoothly transition between tempos within your shared timeline.

Why does my setTimeout animation loop lose synchronization over time?

Your setTimeout loop loses synchronization due to wall-clock drift accumulating across asynchronous calls. Using a deterministic logical-time engine with a TimeContext resolves this by scheduling waits against a drift-free base time.