Clockwork

Clockwork is a TypeScript-first, modular game engine workspace focused on ECS-driven runtime systems and a WebGL2 renderer stack.

Event Bus

Event Bus

qti-clockwork-events provides typed buffered and immediate event channels.

Core API

  • send(event) or send(type, event)
  • sendImmediate(event) or sendImmediate(type, event)
  • listen(type): Events<T>
  • on(type, listener): unsubscribe
  • clear(type?)

Buffered vs Immediate

  • send appends to per-type buffer
  • sendImmediate invokes listeners instantly and does not buffer

Type Inference Rules

Implicit type inference only works for non-primitive class-instance events.

For primitives/plain objects use explicit channel:

events.send(DamageSymbol, { target: 1, amount: 5 })

Events Snapshot

Events<T> is immutable for a read call and exposes:

  • iter()
  • isEmpty()
  • len()
Last updated: February 17, 2026