morefun-forerunnerdb
Version:
A NoSQL document store database for browsers and Node.js.
1,441 lines (405 loc) • 20.5 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Mixin: Triggers</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">Mixin: Triggers</h1>
<section>
<header>
<h2>Triggers</h2>
</header>
<article>
<div class="container-overview">
<div class="description">Provides trigger functionality methods.</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line9">line 9</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id=".addLinkIO"><span class="type-signature">(static) </span>addLinkIO<span class="signature">(id, ioData)</span><span class="type-signature"></span></h4>
<div class="description">
Generates triggers that fire in the after phase for all CRUD ops
that automatically transform data back and forth and keep both
import and export collections in sync with each other.
</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>id</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The unique id for this link IO.</td>
</tr>
<tr>
<td class="name"><code>ioData</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The settings for the link IO.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line105">line 105</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".addTrigger"><span class="type-signature">(static) </span>addTrigger<span class="signature">(id, type, phase, method)</span><span class="type-signature"> → {<a href="global.html#boolean">boolean</a>}</span></h4>
<div class="description">
Add a trigger by id.
</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>id</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The id of the trigger. This must be unique to the type and
phase of the trigger. Only one trigger may be added with this id per type and
phase.</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type"><a href="Constants.html">Constants</a></span>
</td>
<td class="description last">The type of operation to apply the trigger to. See
Mixin.Constants for constants to use.</td>
</tr>
<tr>
<td class="name"><code>phase</code></td>
<td class="type">
<span class="param-type"><a href="Constants.html">Constants</a></span>
</td>
<td class="description last">The phase of an operation to fire the trigger on. See
Mixin.Constants for constants to use.</td>
</tr>
<tr>
<td class="name"><code>method</code></td>
<td class="type">
<span class="param-type"><a href="global.html#addTriggerCallback">addTriggerCallback</a></span>
</td>
<td class="description last">The method to call when the trigger is fired.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line31">line 31</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if the trigger was added successfully, false if not.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#boolean">boolean</a></span>
</dd>
</dl>
<h4 class="name" id=".ignoreTriggers"><span class="type-signature">(static) </span>ignoreTriggers<span class="signature">(val)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Tells the current instance to fire or ignore all triggers whether they
are enabled or not.
</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>val</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last">Set to true to ignore triggers or false to not
ignore them.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line89">line 89</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id=".processTrigger"><span class="type-signature">(static) </span>processTrigger<span class="signature">(operation, type, phase, oldDoc, newDoc)</span><span class="type-signature"> → {<a href="global.html#boolean">boolean</a>}</span></h4>
<div class="description">
Processes trigger actions based on the operation, type and phase.
</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>operation</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">Operation data to pass to the trigger.</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The type of operation. See Mixin.Constants for
constants to use.</td>
</tr>
<tr>
<td class="name"><code>phase</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The phase of the operation. See Mixin.Constants
for constants to use.</td>
</tr>
<tr>
<td class="name"><code>oldDoc</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document snapshot before operations are
carried out against the data.</td>
</tr>
<tr>
<td class="name"><code>newDoc</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The document snapshot after operations are
carried out against the data.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line514">line 514</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=".removeLinkIO"><span class="type-signature">(static) </span>removeLinkIO<span class="signature">(id)</span><span class="type-signature"> → {<a href="global.html#boolean">boolean</a>}</span></h4>
<div class="description">
Removes a previously added link IO via it's ID.
</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>id</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The id of the link IO 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="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line242">line 242</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if successful, false if the link IO
was not found.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#boolean">boolean</a></span>
</dd>
</dl>
<h4 class="name" id=".removeTrigger"><span class="type-signature">(static) </span>removeTrigger<span class="signature">(id, type, phase)</span><span class="type-signature"> → {<a href="global.html#boolean">boolean</a>}</span></h4>
<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>id</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The id of the trigger to remove.</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The type of operation to remove the trigger from. See
Mixin.Constants for constants to use.</td>
</tr>
<tr>
<td class="name"><code>phase</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The phase of the operation to remove the trigger from.
See Mixin.Constants for constants to use.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line67">line 67</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if removed successfully, false if not.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#boolean">boolean</a></span>
</dd>
</dl>
<h4 class="name" id=".willTrigger"><span class="type-signature">(static) </span>willTrigger<span class="signature">(type, phase)</span><span class="type-signature"> → {Boolean}</span></h4>
<div class="description">
Checks if a trigger will fire based on the type and phase provided.
</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>type</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The type of operation. See Mixin.Constants for
constants to use.</td>
</tr>
<tr>
<td class="name"><code>phase</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">The phase of the operation. See Mixin.Constants
for constants to use.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Triggers.js.html">Mixin.Triggers.js</a>, <a href="Mixin.Triggers.js.html#line485">line 485</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if the trigger will fire, false otherwise.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</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="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="Index2d.html">Index2d</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="Procedure.html">Procedure</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="Common.html">Common</a></li><li><a href="Constants.html">Constants</a></li><li><a href="Events.html">Events</a></li><li><a href="Matching.html">Matching</a></li><li><a href="global.html#Shared">Shared</a></li><li><a href="Sorting.html">Sorting</a></li><li><a href="Tags.html">Tags</a></li><li><a href="Triggers.html">Triggers</a></li><li><a href="Updating.html">Updating</a></li></ul><h3>Global</h3><ul><li><a href="global.html#%2522boolean,function%2522">"boolean, function"</a></li><li><a href="global.html#%2522object,function%2522">"object, function"</a></li><li><a href="global.html#%2522object,object,function%2522">"object, object, 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#%2522string,object,function%2522">"string, object, function"</a></li><li><a href="global.html#%2522string,object,object,function%2522">"string, object, object, function"</a></li><li><a href="global.html#%2522string,string,function%2522">"string, string, function"</a></li><li><a href="global.html#%2522string,string,object,function%2522">"string, string, object, function"</a></li><li><a href="global.html#%2522string,string,object,object,function%2522">"string, string, object, object, function"</a></li><li><a href="global.html#access">access</a></li><li><a href="global.html#boolean">boolean</a></li><li><a href="global.html#checksum">checksum</a></li><li><a href="global.html#Condition">Condition</a></li><li><a href="global.html#function">function</a></li><li><a href="global.html#MyModule">MyModule</a></li><li><a href="global.html#name">name</a></li><li><a href="global.html#NodeRAS">NodeRAS</a></li><li><a href="global.html#Section">Section</a></li><li><a href="global.html#server">server</a></li><li><a href="global.html#setData">setData</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Wed Jun 15 2016 17:25:36 GMT+0100 (BST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>