Skip to content

NumberProperty

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

Overview

Property whose value must be a number.

@author Chris Malley (PixelZoom, Inc.) @author Sam Reid (PhET Interactive Simulations)

Class NumberProperty

import { NumberProperty } from 'scenerystack/axon';

Constructor

new NumberProperty( value : number, providedOptions? : NumberPropertyOptions )

Instance Methods

reset()

dispose()

setValueAndRange( value : number, range : Range )

An atomic setting function that will set a range and a value at the same time, to make sure that validation does not fail after one but has been set not the other.

resetValueAndRange()

Resets the value and range atomically. If you use setValueAndRange, you'll likely need to use this instead of reset.

toStateObject() : NumberPropertySelfState & ReadOnlyPropertyState<StateType>

Get parent state and append NumberProperty-specific metadata to it.

Instance Properties

rangeProperty : Property<Range>

(readonly)

Static Properties

NumberPropertyIO : IOType

Type NumberPropertyOptions

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

Type NumberPropertyState

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

Source Code

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