Class State
Maintain state for a collection of items. Individual properties
are stored in hash tables. This is instead of having state objects
for each item in the collection. For large collections, especially
changing ones, this approach may perform better.
Methods
void
add
(
name
,
o
)
Add an item with all of the properties in the supplied object.
- Parameters:
-
name
<string>
identifier for this attribute
-
o
<object>
hash of attributes
- Returns:
void
get
(
name
,
key
)
For a given item, gets an attribute. If key is not
supplied, a disposable object with all attributes is
returned. Use of the latter option makes sense when
working with single items, but not if object explosion
might cause gc problems.
- Parameters:
-
name
<string>
name of attribute
-
key
<string>
optional attribute to get
void
remove
(
name
,
o
)
Remove entire item, or optionally specified fields
- Parameters:
-
name
<string>
name of attribute
-
o
<string|object|array>
single key or collection of keys to delete
- Returns:
void