Skip to content

EnabledComponent

Overview

Base class that defines a settable Property that determines whether the Object is enabled or not. This includes support for phet-io instrumentation and a variety of options to customize the enabled Property as well as how it is created.

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

Class EnabledComponent

import { EnabledComponent } from 'scenerystack/axon';

Constructor

new EnabledComponent( providedOptions? : EnabledComponentOptions )

Instance Methods

isEnabled() : boolean

dispose()

Instance Properties

enabledProperty : TProperty<boolean>

Type EnabledComponentOptions

import type { EnabledComponentOptions } from 'scenerystack/axon';
  • enabledProperty?: TReadOnlyProperty<boolean> | null
    if not provided, a Property will be created
  • enabled?: boolean
    initial value of enabledProperty if we create it, ignored if enabledProperty is provided
  • enabledPropertyOptions?: EnabledPropertyOptions | null
    options to enabledProperty if we create it, ignored if enabledProperty is provided
  • phetioEnabledPropertyInstrumented?: boolean
    Whether the default-created enabledProperty should be instrumented for PhET-iO. Ignored if options.enabledProperty is provided.
  • & Pick<PhetioObjectOptions, "tandem"> & DisposableOptions

Source Code

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