State.html revision 4fcbec6145d16637205990699912fb90f6a3807c
<html>
<head>
<title>API: attribute State (YUI Library)</title>
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<h3>attribute <span class="subtitle">3.00PR1</span></h3>
<p>
> State
</p>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<form name="yui-classopts-form">
<span id="classopts"><input type="checkbox" name="showprivate" id="showprivate" /> <label for="showprivate">Show Private</label></span>
<span id="classopts"><input type="checkbox" name="showprotected" id="showprotected" /> <label for="showprotected">Show Protected</label></span>
<span id="classopts"><input type="checkbox" name="showdeprecated" id="showdeprecated" /> <label for="showdeprecated">Show Deprecated</label></span>
</form>
<h2>
Class <b>State</b>
<span class="extends">
</span>
<span class="extends">
</span>
</code>
</h2>
<!-- class tree goes here -->
<div class="summary description">
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.
</div>
<div class="section constructor details">
<h3 id="constructor">Constructor</h3>
<div class="content">
<div class="detail">
<strong>State</strong>
<code>
(
)
</code>
<div class="description">
</div>
</div>
</div>
</div>
<div class="section field details">
<h3 id="properties">Properties</h3>
<div class="content">
<div class="">
<h4><a name="property_data">data</a>
<code>- object</code>
</h4>
<div class="detail">
<div class="description">
Hash of attributes
</div>
</div>
<hr />
</div>
</div>
</div>
<div class="section method details">
<h3 id="methods">Methods</h3>
<div class="content">
<div class="">
<h4>
<a name="method_add">add</a></h4>
<div class="detail">
<code>
void
<strong>add</strong>
(
name
,
o
)
</code>
<div class="description">
Add an item with all of the properties in the supplied object.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>name <string></code>
identifier for this attribute
</dd>
<dd>
<code>o <object></code>
hash of attributes
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_get">get</a></h4>
<div class="detail">
<code>
void
<strong>get</strong>
(
name
,
key
)
</code>
<div class="description">
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.
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>name <string></code>
name of attribute
</dd>
<dd>
<code>key <string></code>
optional attribute to get
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd>either the value of the supplied key or an object with
all data.</dd>
</dl>
</div>
</div>
<hr />
</div>
<div class="">
<h4>
<a name="method_remove">remove</a></h4>
<div class="detail">
<code>
void
<strong>remove</strong>
(
name
,
o
)
</code>
<div class="description">
Remove entire item, or optionally specified fields
</div>
<div class="description">
<dl>
<dt>Parameters:</dt>
<dd>
<code>name <string></code>
name of attribute
</dd>
<dd>
<code>o <string|object|array></code>
single key or collection of keys to delete
</dd>
</dl>
<dl>
<dt>Returns:
<code>
void
</code></dt>
<dd></dd>
</dl>
</div>
</div>
<hr />
</div>
</div>
</div>
</div>
</div>
<div class="yui-b">
<div class="nav">
<div class="module">
<h4>Modules</h4>
<ul class="content">
</ul>
</div>
<div class="module">
<h4>Classes</h4>
<ul class="content">
</ul>
</div>
<div class="module">
<h4>Files</h4>
<ul class="content">
</ul>
</div>
<div class="module">
<h4>Properties</h4>
<ul class="content">
<li class=""><a href="#property_data">data</a>
<!--<code><object></code>-->
</li>
</ul>
</div>
<div class="module">
<h4>Methods</h4>
<ul class="content">
<li class=""><!--<code>void</code>-->
<a href="#method_add">add</a>
</li>
<li class=""><!--<code>void</code>-->
<a href="#method_get">get</a>
</li>
<li class=""><!--<code>void</code>-->
<a href="#method_remove">remove</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright © 2008 Yahoo! Inc. All rights reserved.
</div>
</div>
</body>
</html>