NumberProperty¶
Overview¶
Property whose value must be a number.
@author Chris Malley (PixelZoom, Inc.) @author Sam Reid (PhET Interactive Simulations)
Class NumberProperty¶
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¶
- numberType?: NumberType
- range?: Range | Property<Range>
- rangePropertyOptions?: PropertyOptions<Range>
Passed to this.rangeProperty if NumberProperty creates it. Ignored if a Property is provided via options.range. - & StrictOmit<PropertyOptions<number>, "phetioValueType" | "valueType">
Type NumberPropertyState¶
- numberType: string
- range: RangeStateObject
- rangePhetioID: PhetioID | null
- & ReadOnlyPropertyState<number>
Source Code¶
See the source for NumberProperty.ts in the axon repository.