{"version":3,"file":"index.cjs","sources":["../../src/scheduler/manual-driver.ts"],"sourcesContent":["import type { FrameDriver } from './driver'\n\n/**\n * Test-only frame driver: frames are produced by calling `frame(timestampMs)`\n * manually, with full control over timestamps (and therefore deltas).\n * Not exported from the package entry point.\n */\nexport interface ManualDriver extends FrameDriver {\n  /** Run all callbacks scheduled for the next frame, at the given timestamp. */\n  frame(timestampMs: number): void\n  /** Number of callbacks currently waiting for the next frame. */\n  pendingCount(): number\n  /** Total number of schedule() calls since creation (batching assertions). */\n  scheduleCalls(): number\n}\n\nexport function createManualDriver(): ManualDriver {\n  let pending: Array<(timestampMs: number) => void> = []\n  let calls = 0\n\n  return {\n    schedule(callback) {\n      calls += 1\n      pending.push(callback)\n      return () => {\n        pending = pending.filter((p) => p !== callback)\n      }\n    },\n    frame(timestampMs) {\n      const batch = pending\n      pending = []\n      for (const callback of batch) callback(timestampMs)\n    },\n    pendingCount: () => pending.length,\n    scheduleCalls: () => calls,\n  }\n}\n"],"names":["createManualDriver","pending","calls","callback","p","timestampMs","batch"],"mappings":"gFAgBO,SAASA,GAAmC,CACjD,IAAIC,EAAgD,CAAA,EAChDC,EAAQ,EAEZ,MAAO,CACL,SAASC,EAAU,CACjB,OAAAD,GAAS,EACTD,EAAQ,KAAKE,CAAQ,EACd,IAAM,CACXF,EAAUA,EAAQ,OAAQG,GAAMA,IAAMD,CAAQ,CAChD,CACF,EACA,MAAME,EAAa,CACjB,MAAMC,EAAQL,EACdA,EAAU,CAAA,EACV,UAAWE,KAAYG,EAAOH,EAASE,CAAW,CACpD,EACA,aAAc,IAAMJ,EAAQ,OAC5B,cAAe,IAAMC,CAAA,CAEzB"}