Skip to content

GatedBooleanProperty

Overview

The GatedBooleanProperty class abstracts the process of creating a boolean Property with an extra controlling Property. Partially designed for its primary use case, PhET-iO instrumented Properties. This pattern comes in handy when an object's boolean value is already controlled within the simulation, but there is a need to grant additional control to an external entity such as a studio or a PhET-iO client. Here "gate" is an extra level of control (via the composed Property). The class is a DerivedProperty that listens correctly to convey the boolean with respect to all inputs.

Subclasses GatedVisibleProperty and GatedEnabledProperty should be used when your Property fills the role of a visibleProperty or enabledProperty respectively. These subclasses provide standardized tandem names and PhET-iO metadata.

@author Marla Schulz (PhET Interactive Simulations) @author Michael Kauzmann (PhET Interactive Simulations) @author Sam Reid (PhET Interactive Simulations)

Class GatedBooleanProperty

import { GatedBooleanProperty } from 'scenerystack/axon';

Constructor

new GatedBooleanProperty( providedBooleanProperty : TReadOnlyProperty<boolean>, parentTandem : Tandem, providedOptions? : GatedBooleanPropertyOptions )

Instance Methods

dispose()

Instance Properties

selfBooleanProperty : TProperty<boolean>

(readonly)

Class GatedEnabledProperty

import { GatedEnabledProperty } from 'scenerystack/axon';

Constructor

new GatedEnabledProperty( providedBooleanProperty : TReadOnlyProperty<boolean>, parentTandem : Tandem, providedOptions? : GatedBooleanPropertyOptions )

Instance Methods

Class GatedVisibleProperty

import { GatedVisibleProperty } from 'scenerystack/axon';

Constructor

new GatedVisibleProperty( providedBooleanProperty : TReadOnlyProperty<boolean>, parentTandem : Tandem, providedOptions? : GatedBooleanPropertyOptions )

Instance Methods

Source Code

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