ReadonlyattributesReturn a snapshot of the current attributes, including inherited ones. This value is read-only and reflects the state of the attributes at the time of access, and the returned instance will not change if any attributes are modified later, you will need to access the attributes property again to get the latest state.
Note: As this causes a snapshot to be taken, it is an expensive operation as it enumerates all attributes, so you SHOULD use this property sparingly.
Create a child attribute container that inherits from this one, optionally taking a snapshot so that any future changes to the parent container do not affect the child container. The child will use all of the configuration from the parent container.
Optionalname: stringOptional name for the child container
Optionalsnapshot: booleanIf true, the child container will be a snapshot of the current state
A new attribute container instance
Clear all existing attributes from the container, this will also remove any inherited attributes from this instance only (it will not change the inherited attributes / container(s))
Delete an existing attribute, if the key doesn't exist this will return false. If the key does exist then it will be removed from this instance and any inherited value will be hidden (even if the inherited value changes)
The attribute key to delete
True if the attribute was deleted, false if it didn't exist (which includes if it has already been deleted)
ReadonlydroppedThe number of attributes that were dropped due to the attribute limit being reached
The entries() method of returns a new iterator object that contains the [key, value, source?] tuples for each attribute, it returns all existing attributes of this instance including all inherited ones. If the same key exists in both the local and inherited attributes, only the first (non-deleted) tuple will be returned. If the key has been deleted, it will not be included in the iterator.
The source value of the tuple identifies the origin of the attribute (Local or Inherited).
An iterator over the entries of the attribute container
The forEach() method of executes a provided function once per each key/value pair in this attribute container, it will process all local attributes first, then the inherited attributes. If the same key exists in both the local and inherited attributes, only the first (non-deleted) key/value pair will be processed. If a key has been deleted, it will not be included in the set of processed key/value pairs.
The function to execute for each key/value pair
Optionalsource: eAttributeFilterOptionalthisArg: anyOptional value to use as this when executing callback
Get the value of an attribute by key
The attribute key to retrieve
Optionalsource: eAttributeFilterOptional filter to only check attributes from a specific source (Local or Inherited)
The attribute value if found, undefined otherwise
Check if an attribute exists by key
The attribute key to check
Optionalsource: eAttributeFilterOptional filter to only check attributes from a specific source (Local or Inherited)
True if the attribute exists, false otherwise
ReadonlyidUnique identifier for the attribute container
The keys() method returns a new iterator object that contains the existing keys for each element in this attribute container. It will return all locally set keys first and then the inherited keys. When a key exists in both the local and inherited attributes, only the local key will be returned. If the key has been deleted locally, it will not be included in the iterator.
An iterator over the keys of the attribute container
Register a callback listener for any attribute changes, this will include local and inherited changes.
Function to be called when attributes change, receives change information
IUnloadHook instance with rm() function to remove this listener, once called it will never be invoked again
Set the value of an attribute by key on this instance.
The attribute key to set
The value to assign to the named attribute
true if the value was successfully set / replaced
ReadonlysizeThe number of attributes that have been set
The values() method returns a new iterator instance that contains the values for each element in this attribute container. It will return all locally set values first and then the inherited values. If the same key is present in both the local or inherited attributes only the first (non-deleted) value will be returned. If a key has been deleted, it will not be included in the iterator.
Interface for an attribute container
Since
3.4.0