forerunnerdb
Version:
A NoSQL document store database for browsers and Node.js.
3,082 lines (755 loc) • 34.9 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: OldView</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: OldView</h1>
<section>
<header>
<h2>
OldView
</h2>
</header>
<article>
<div class="container-overview">
<h4 class="name" id="OldView"><span class="type-signature"></span>new OldView<span class="signature">(viewName)</span><span class="type-signature"></span></h4>
<div class="description">
The view constructor.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>viewName</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line19">line 19</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="bind"><span class="type-signature"></span>bind<span class="signature">(selector, options)</span><span class="type-signature"></span></h4>
<div class="description">
Binds a selector to the insert, update and delete events of a particular
view and keeps the selector in sync so that updates are reflected on the
web page in real-time.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>selector</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The jQuery selector string to get target elements.</td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The options object.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.Bind.js.html">OldView.Bind.js</a>, <a href="OldView.Bind.js.html#line80">line 80</a>
</li></ul></dd>
</dl>
<h4 class="name" id="bindRender"><span class="type-signature"></span>bindRender<span class="signature">(bindSelector, domHandler<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Renders a bind view data to the DOM.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>bindSelector</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">The jQuery selector string to use to identify
the bind target. Must match the selector used when defining the original bind.</td>
</tr>
<tr>
<td class="name"><code>domHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#function">function</a></span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">If specified, this handler method will be called
with the final HTML for the view instead of the DB handling the DOM insertion.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.Bind.js.html">OldView.Bind.js</a>, <a href="OldView.Bind.js.html#line189">line 189</a>
</li></ul></dd>
</dl>
<h4 class="name" id="bindSortDom"><span class="type-signature"></span>bindSortDom<span class="signature">(selector, itemArr)</span><span class="type-signature"></span></h4>
<div class="description">
Sorts items in the DOM based on the bind settings and the passed item array.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>selector</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The jQuery selector of the bind container.</td>
</tr>
<tr>
<td class="name"><code>itemArr</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last">The array of items used to determine the order the DOM
elements should be in based on the order they are in, in the array.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.Bind.js.html">OldView.Bind.js</a>, <a href="OldView.Bind.js.html#line115">line 115</a>
</li></ul></dd>
</dl>
<h4 class="name" id="count"><span class="type-signature"></span>count<span class="signature">()</span><span class="type-signature"> → {Number}</span></h4>
<div class="description">
Returns the number of documents currently in the view.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line496">line 496</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="db"><span class="type-signature"></span>db<span class="signature">(db)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Gets / sets the DB the view is bound against. Automatically set
when the db.oldView(viewName) method is called.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>db</code></td>
<td class="type">
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line106">line 106</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="drop"><span class="type-signature"></span>drop<span class="signature">()</span><span class="type-signature"> → {<a href="global.html#boolean">boolean</a>}</span></h4>
<div class="description">
Drops a view and all it's stored data from the database.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line71">line 71</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True on success, false on failure.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#boolean">boolean</a></span>
</dd>
</dl>
<h4 class="name" id="find"><span class="type-signature"></span>find<span class="signature">()</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Queries the view data. See Collection.find() for more information.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line504">line 504</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="from"><span class="type-signature"></span>from<span class="signature">(collection)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Gets / sets the collection that the view derives it's data from.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>collection</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">A collection instance or the name of a collection
to use as the data set to derive view data from.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line121">line 121</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="insert"><span class="type-signature"></span>insert<span class="signature">()</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Inserts into view data via the view collection. See Collection.insert() for more information.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line520">line 520</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="isBound"><span class="type-signature"></span>isBound<span class="signature">(selector)</span><span class="type-signature"> → {<a href="global.html#boolean">boolean</a>}</span></h4>
<div class="description">
Returns true if the selector is bound to the view.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>selector</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The jQuery selector string to identify the bind to check for.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.Bind.js.html">OldView.Bind.js</a>, <a href="OldView.Bind.js.html#line105">line 105</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#boolean">boolean</a></span>
</dd>
</dl>
<h4 class="name" id="primaryKey"><span class="type-signature"></span>primaryKey<span class="signature">()</span><span class="type-signature"> → {String}</span></h4>
<div class="description">
Gets the primary key for this view from the assigned collection.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line187">line 187</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id="query"><span class="type-signature"></span>query<span class="signature">(query<span class="signature-attributes">opt</span>, refresh<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Gets / sets the query being used to generate the view data.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">The query to set.</td>
</tr>
<tr>
<td class="name"><code>refresh</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Whether to refresh the view data after
this operation. Defaults to true.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line284">line 284</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="queryAdd"><span class="type-signature"></span>queryAdd<span class="signature">(obj, overwrite, refresh<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Add data to the existing query.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last">The data whose keys will be added to the existing
query object.</td>
</tr>
<tr>
<td class="name"><code>overwrite</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
</td>
<td class="description last">Whether or not to overwrite data that already
exists in the query object. Defaults to true.</td>
</tr>
<tr>
<td class="name"><code>refresh</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Whether or not to refresh the view data set
once the operation is complete. Defaults to true.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line232">line 232</a>
</li></ul></dd>
</dl>
<h4 class="name" id="queryData"><span class="type-signature"></span>queryData<span class="signature">(query<span class="signature-attributes">opt</span>, options<span class="signature-attributes">opt</span>, refresh<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Gets / sets the query that the view uses to build it's data set.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>query</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">An options object.</td>
</tr>
<tr>
<td class="name"><code>refresh</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Whether to refresh the view data after
this operation. Defaults to true.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line203">line 203</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="queryOptions"><span class="type-signature"></span>queryOptions<span class="signature">(options<span class="signature-attributes">opt</span>, refresh<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Gets / sets the query options used when applying sorting etc to the
view data set.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">An options object.</td>
</tr>
<tr>
<td class="name"><code>refresh</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Whether to refresh the view data after
this operation. Defaults to true.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line305">line 305</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="queryRemove"><span class="type-signature"></span>queryRemove<span class="signature">(obj, refresh<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Remove data from the existing query.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="attributes">
</td>
<td class="description last">The data whose keys will be removed from the existing
query object.</td>
</tr>
<tr>
<td class="name"><code>refresh</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Whether or not to refresh the view data set
once the operation is complete. Defaults to true.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line259">line 259</a>
</li></ul></dd>
</dl>
<h4 class="name" id="refresh"><span class="type-signature"></span>refresh<span class="signature">()</span><span class="type-signature"></span></h4>
<div class="description">
Refreshes the view data and diffs between previous and new data to
determine if any events need to be triggered or DOM binds updated.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line322">line 322</a>
</li></ul></dd>
</dl>
<h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">()</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Removed from view data via the view collection. See Collection.remove() for more information.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line546">line 546</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id="unBind"><span class="type-signature"></span>unBind<span class="signature">(selector)</span><span class="type-signature"> → {<a href="Collection.html">Collection</a>}</span></h4>
<div class="description">
Un-binds a selector from the view changes.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>selector</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The jQuery selector string to identify the bind to remove.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.Bind.js.html">OldView.Bind.js</a>, <a href="OldView.Bind.js.html#line95">line 95</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Collection.html">Collection</a></span>
</dd>
</dl>
<h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">()</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Updates into view data via the view collection. See Collection.update() for more information.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="OldView.js.html">OldView.js</a>, <a href="OldView.js.html#line533">line 533</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="ActiveBucket.html">ActiveBucket</a></li><li><a href="Angular.html">Angular</a></li><li><a href="AutoBind.html">AutoBind</a></li><li><a href="BinaryTree.html">BinaryTree</a></li><li><a href="Collection.html">Collection</a></li><li><a href="CollectionGroup.html">CollectionGroup</a></li><li><a href="Core.html">Core</a></li><li><a href="Db.html">Db</a></li><li><a href="Document.html">Document</a></li><li><a href="Grid.html">Grid</a></li><li><a href="Highchart.html">Highchart</a></li><li><a href="IndexBinaryTree.html">IndexBinaryTree</a></li><li><a href="IndexHashMap.html">IndexHashMap</a></li><li><a href="Infinilist.html">Infinilist</a></li><li><a href="KeyValueStore.html">KeyValueStore</a></li><li><a href="Metrics.html">Metrics</a></li><li><a href="OldView.html">OldView</a></li><li><a href="Operation.html">Operation</a></li><li><a href="Overload.html">Overload</a></li><li><a href="Path.html">Path</a></li><li><a href="Persist.html">Persist</a></li><li><a href="ReactorIO.html">ReactorIO</a></li><li><a href="Serialiser.html">Serialiser</a></li><li><a href="Shared.overload.html">overload</a></li><li><a href="View.html">View</a></li></ul><h3>Mixins</h3><ul><li><a href="ChainReactor.html">ChainReactor</a></li><li><a href="crcTable.html">crcTable</a></li><li><a href="Shared.html">Shared</a></li></ul><h3>Global</h3><ul><li><a href="global.html#%2522boolean,function%2522">"boolean, function"</a></li><li><a href="global.html#%2522string,*,function%2522">"string, *, function"</a></li><li><a href="global.html#%2522string,function%2522">"string, function"</a></li><li><a href="global.html#boolean">boolean</a></li><li><a href="global.html#function">function</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.3</a> on Thu Nov 19 2015 13:31:32 GMT+0000 (GMT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>