Skip to content

TReadOnlyProperty

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/TReadOnlyProperty.ts for the most up-to-date information.

Overview

A simple read-only Property/TinyProperty-like interface

@author Sam Reid (PhET Interactive Simulations) @author Jonathan Olson <jonathan.olson@colorado.edu>

Type TReadOnlyProperty

See comments in Property.ts / TinyProperty.ts

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

Type PropertyLazyLinkListener

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

( value: T, oldValue: T, tinyProperty: TReadOnlyProperty<T> ) => void

Type PropertyLinkListener

Even though these are the same types used for TProperty, it is vital that the tinyProperty parameter remains TReadOnlyProperty to avoid contravariance type errors that may not be checked by TypeScript because contravariance type checking is ignored in "method" types but not in "property" types. See https://github.com/phetsims/axon/issues/428#issuecomment-2033071432

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

( value: T, oldValue: T | null, tinyProperty: TReadOnlyProperty<T> ) => void

Type PropertyListener

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

PropertyLinkListener<T> | PropertyLazyLinkListener<T>

Source Code

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