Skip to content

TEmitter

Overview

Event & listener abstraction for a single "event" type. Unified interface for usage across the concrete implementations: - Emitter: PhET-iO instrumented Emitter - TinyEmitter: Lightweight version without phet-io for when performance/memory are critical

@author Sam Reid (PhET Interactive Simulations)

Type TEmitter

import type { TEmitter } from 'scenerystack/axon';

TReadOnlyEmitter<T> & { emit: ( ...args: T ) => void; dispose: () => void }

Type TEmitterListener

import type { TEmitterListener } from 'scenerystack/axon';

( ...args: T ) => void

Type TEmitterParameter

undefined and never are not allowed as parameters to Emitter

import type { TEmitterParameter } from 'scenerystack/axon';

Exclude<IntentionalAny, undefined | never>

Source Code

See the source for TEmitter.ts in the axon repository.