TEmitter¶
Under Construction
This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/axon/blob/main/js/TEmitter.ts for the most up-to-date information.
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¶
TReadOnlyEmitter<T> & { emit: ( ...args: T ) => void; dispose: () => void }
Type TEmitterListener¶
( ...args: T ) => void
Type TEmitterParameter¶
undefined and never are not allowed as parameters to Emitter
Exclude<IntentionalAny, undefined | never>
Type TReadOnlyEmitter¶
A "read only" version of an emitter. You can listen to it, but cannot control it
- addListener: ( listener: TEmitterListener<T> ) => void
- hasListener: ( listener: TEmitterListener<T> ) => boolean
- removeListener: ( listener: TEmitterListener<T> ) => void
- removeAllListeners: () => void
Source Code¶
See the source for TEmitter.ts in the axon repository.