Class: PropertyBag

PropertyBag

new PropertyBag(valueopt, createPropertyCallbackopt)

A Property whose value is a key-value mapping of property names to the computed value of other properties.
Parameters:
Name Type Attributes Description
value Object <optional>
An object, containing key-value mapping of property names to properties.
createPropertyCallback function <optional>
A function that will be called when the value of any of the properties in value are not a Property.
Source:

Members

(readonly) definitionChanged :Event

Gets the event that is raised whenever the set of properties contained in this object changes, or one of the properties itself changes.
Type:
Source:

(readonly) isConstant :Boolean

Gets a value indicating if this property is constant. This property is considered constant if all property items in this object are constant.
Type:
  • Boolean
Source:

propertyNames :Array

Gets the names of all properties registered on this instance.
Type:
  • Array
Source:

Methods

addProperty(propertyName, valueopt, createPropertyCallbackopt)

Adds a property to this object.
Parameters:
Name Type Attributes Description
propertyName String The name of the property to add.
value Any <optional>
The value of the new property, if provided.
createPropertyCallback function <optional>
A function that will be called when the value of this new property is set to a value that is not a Property.
Source:
Throws:
"propertyName" is already a registered property.
Type
DeveloperError

equals(otheropt) → {Boolean}

Compares this property to the provided property and returns true if they are equal, false otherwise.
Parameters:
Name Type Attributes Description
other Property <optional>
The other property.
Source:
Returns:
true if left and right are equal, false otherwise.
Type
Boolean

getValue(time, resultopt) → {Object}

Gets the value of this property. Each contained property will be evaluated at the given time, and the overall result will be an object, mapping property names to those values.
Parameters:
Name Type Attributes Description
time JulianDate The time for which to retrieve the value.
result Object <optional>
The object to store the value into, if omitted, a new instance is created and returned. Note that any properties in result which are not part of this PropertyBag will be left as-is.
Source:
Returns:
The modified result parameter or a new instance if the result parameter was not supplied.
Type
Object

hasProperty(propertyName) → {Boolean}

Determines if this object has defined a property with the given name.
Parameters:
Name Type Description
propertyName String The name of the property to check for.
Source:
Returns:
True if this object has defined a property with the given name, false otherwise.
Type
Boolean

merge(source, createPropertyCallbackopt)

Assigns each unassigned property on this object to the value of the same property on the provided source object.
Parameters:
Name Type Attributes Description
source Object The object to be merged into this object.
createPropertyCallback function <optional>
A function that will be called when the value of any of the properties in value are not a Property.
Source:

removeProperty(propertyName)

Removed a property previously added with addProperty.
Parameters:
Name Type Description
propertyName String The name of the property to remove.
Source:
Throws:
"propertyName" is not a registered property.
Type
DeveloperError