State.html revision 4fcbec6145d16637205990699912fb90f6a3807c
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>API: attribute State (YUI Library)</title>
<link rel="stylesheet" type="text/css" href="assets/api.css">
<script type="text/javascript" src="assets/api-js"></script>
<script type="text/javascript" src="assets/ac-js"></script>
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<a href="http://developer.yahoo.com/yui/"><h1>Yahoo! UI Library</h1></a>
<h3>attribute&nbsp; <span class="subtitle">3.00PR1</span></h3>
<p>
<a href="/index.html">Yahoo! UI Library</a>
&gt; <a href="/module_attribute.html">attribute</a>
&gt; 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 &lt;string&gt;</code>
identifier for this attribute
</dd>
<dd>
<code>o &lt;object&gt;</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 &lt;string&gt;</code>
name of attribute
</dd>
<dd>
<code>key &lt;string&gt;</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 &lt;string&gt;</code>
name of attribute
</dd>
<dd>
<code>o &lt;string|object|array&gt;</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">
<li class=""><a href="module_anim.html">anim</a></li>
<li class="selected"><a href="module_attribute.html">attribute</a></li>
<li class=""><a href="module_base.html">base</a></li>
<li class=""><a href="module_dd.html">dd</a></li>
<li class=""><a href="module_dd-plugin.html">dd-plugin</a></li>
<li class=""><a href="module_dump.html">dump</a></li>
<li class=""><a href="module_event.html">event</a></li>
<li class=""><a href="module_io.html">io</a></li>
<li class=""><a href="module_node.html">node</a></li>
<li class=""><a href="module_oop.html">oop</a></li>
<li class=""><a href="module_queue.html">queue</a></li>
<li class=""><a href="module_substitute.html">substitute</a></li>
<li class=""><a href="module_yui.html">yui</a></li>
</ul>
</div>
<div class="module">
<h4>Classes</h4>
<ul class="content">
<li class=""><a href="Attribute.html">Attribute</a></li>
<li class="selected"><a href="State.html">State</a></li>
</ul>
</div>
<div class="module">
<h4>Files</h4>
<ul class="content">
<li class=""><a href="Attribute.js.html">Attribute.js</a></li>
<li class=""><a href="State.js.html">State.js</a></li>
</ul>
</div>
<div class="module">
<h4>Properties</h4>
<ul class="content">
<li class=""><a href="#property_data">data</a>
<!--<code>&lt;object&gt;</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 &copy; 2008 Yahoo! Inc. All rights reserved.
</div>
</div>
</body>
</html>