Yahoo! UI Library

attribute  3.0.0pr2

Yahoo! UI Library > attribute > State
Search:
 
Filters

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.

Constructor

State ( )

Properties

data - object

Hash of attributes

Methods

add

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

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

remove

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


Copyright © 2008 Yahoo! Inc. All rights reserved.