Skip to content

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

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>

Type TReadOnlyEmitter

A "read only" version of an emitter. You can listen to it, but cannot control it

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

Source Code

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