npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kinesisjs/core

v0.5.1

Published

TypeScript-first, framework-agnostic vehicle interpolation engine — core

Downloads

708

Readme

@kinesisjs/core

Pure-TypeScript interpolation engine — framework-agnostic, ~5 KB minified+gzipped.

npm Downloads Bundle size Provenance Changelog License TypeScript

Mathematical engine for smooth movement between periodic position updates. No dependency on any map library or UI framework; extends through the adapter pattern.

Scope

  • rAF-based clock — 60fps tick, no tab-background catch-up jumps
  • Interpolation modes — linear, cubic, geodesic, smooth (3-point Catmull-Rom), none, adaptive
  • Playout bufferplayout: { pace, bufferMs } | 'auto' re-times jittery ingest into a constant per-segment render pace
  • Web Worker modeworker: true runs the tick loop off the main thread (adapter stays on it)
  • Bounded memory — ring slot pattern, allocation-free hot path
  • Multi-state lifecycleactive / warning / stale / completed + markCompleted API
  • Sanity checks — anomalous-jump (distance vs. speed) and sharp-turn (heading) detection
  • Typed event bustick, vehicleadded, vehiclewarning, vehiclestale, vehiclecompleted, vehicleremoved, ingest, error
  • TrackAdapter interface — map adapters implement this contract
  • CustomInterpolator interface — sync/async; the extension point behind @kinesisjs/route-aware
  • math-utilshaversineDistance, shortestArcDiff, linearLerp, catmullRomLerp as public exports

Out of scope

  • Map feature lifecycle → adapter packages
  • Framework lifecycle → wrapper packages
  • Data fetching, WebSocket management → application code

Installation

pnpm add @kinesisjs/core

Usage

import { Tracker } from '@kinesisjs/core';
import type { TrackAdapter, TrailPoint, Position } from '@kinesisjs/core';

class MyAdapter implements TrackAdapter {
  addVehicle(id: string, p: TrailPoint): void {
    /* draw on your map */
  }
  updatePosition(id: string, p: TrailPoint): void {
    /* feature.setCoordinates */
  }
  removeVehicle(id: string): void {
    /* remove from layer */
  }
  destroy(): void {
    /* cleanup */
  }
  // Optional: updateOpacity(id, opacity), getMemoryEstimate()
}

const tracker = new Tracker({
  adapter: new MyAdapter(),
  interpolation: 'adaptive',
});

tracker.start();
tracker.on('vehiclestale', ({ vehicleId }) => console.log(`${vehicleId} stale`));
tracker.on('error', (e) => console.warn(`[${e.code}]`, e.message));

// From your WebSocket handler:
const positions: Position[] = [{ id: 'v1', lng: 29, lat: 41 }];
tracker.ingest(positions);

Jittery feeds

When the gap between fixes varies (e.g. 0.5–3 s), pair the playout buffer with smooth interpolation — smooth shapes the geometry (no kinks at waypoints), playout flattens the tempo:

const tracker = new Tracker({
  adapter: new MyAdapter(),
  interpolation: 'smooth', // 3-point Catmull-Rom
  playout: 'auto', // measure ingest cadence, equalise the render pace
});

Public API

// Classes
export { Tracker, WorkerTracker, Clock, Interpolator, AdaptiveInterpolator, EventBus, Sweeper };

// Utilities
export { catmullRomLerp, haversineDistance, linearLerp, shortestArcDiff };

// Types
export type {
  Position,
  TrailPoint,
  VehicleSlot,
  VehicleState,
  SweepResult,
  InitialPositionBehavior,
  TrackerOptions,
  TrackerStats,
  TrackerEventMap,
  TrackAdapter,
  InterpolationMode,
  CustomInterpolator,
  InterpolationOptions,
  AdaptiveOptions,
  AdaptiveBehavior,
  TrackerError,
  TrackerErrorCode,
  FadeAnimationOptions,
  PlayoutOptions,
  PlayoutQueueEntry,
};

Performance

Interpolator.compute linear: ~50 ns/call (20M ops/sec). Tracker.tick with 1000 vehicles: ~0.15 ms (about 1% of the 60fps tick budget).

License

MIT