forerunnerdb
Version:
A NoSQL document store database for browsers and Node.js.
1,876 lines (496 loc) • 25 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Mixin: Events</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: Events</h1>
<section>
<header>
<h2>Events</h2>
</header>
<article>
<div class="container-overview">
<div class="description">Provides event emitter functionality including the methods: on, off, once, emit, deferEmit.</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.js.html#line5">line 5</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<ul><li><a href="#deferEmit"><span class="type-signature">(static) </span>deferEmit<span class="signature">(eventName, data<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></a></li><li><a href="#emit"><span class="type-signature">(static) </span>emit<span class="signature">(event, data)</span><span class="type-signature"> → {*}</span></a></li><li><a href="#off"><span class="type-signature">(static) </span>off<span class="signature">(event, id)</span><span class="type-signature"></span></a></li><li><a href="#off"><span class="type-signature">(static) </span>off<span class="signature">(event, id, listener)</span><span class="type-signature"></span></a></li><li><a href="#off"><span class="type-signature">(static) </span>off<span class="signature">(event, listener)</span><span class="type-signature"> → {*}</span></a></li><li><a href="#off"><span class="type-signature">(static) </span>off<span class="signature">(event)</span><span class="type-signature"> → {*}</span></a></li><li><a href="#on"><span class="type-signature">(static) </span>on<span class="signature">(event, id, listener)</span><span class="type-signature"> → {*}</span></a></li><li><a href="#on"><span class="type-signature">(static) </span>on<span class="signature">(event, listener)</span><span class="type-signature"> → {*}</span></a></li><li><a href="#once"><span class="type-signature">(static) </span>once<span class="signature">(event, id, listener)</span><span class="type-signature"> → {*}</span></a></li><li><a href="#once"><span class="type-signature">(static) </span>once<span class="signature">(event, listener)</span><span class="type-signature"> → {*}</span></a></li></ul>
<h4 class="name" id=".deferEmit"><span class="type-signature">(static) </span>deferEmit<span class="signature">(eventName, data<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
<div class="description">
Queues an event to be fired. This has automatic de-bouncing so that any
events of the same type that occur within 100 milliseconds of a previous
one will all be wrapped into a single emit rather than emitting tons of
events for lots of chained inserts etc. Only the data from the last
de-bounced event will be emitted.
</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>eventName</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last">The name of the event to emit.</td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="description last">Optional data to emit with the event.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.js.html#line305">line 305</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".emit"><span class="type-signature">(static) </span>emit<span class="signature">(event, data)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Emit an event with data.
</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>event</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The event to emit.</td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">Data to emit with the event.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.js.html#line213">line 213</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id=".off"><span class="type-signature">(static) </span>off<span class="signature">(event, id)</span><span class="type-signature"></span></h4>
<div class="description">
Cancels all listeners for an event based on the passed event name and 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>event</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The event name to cancel listeners for.</td>
</tr>
<tr>
<td class="name"><code>id</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">The ID to cancel all listeners for.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.js.html#line189">line 189</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".off"><span class="type-signature">(static) </span>off<span class="signature">(event, id, listener)</span><span class="type-signature"></span></h4>
<div class="description">
Cancels an event listener based on an event name, id and listener function.
</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>event</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The event to cancel listener for.</td>
</tr>
<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 event to cancel listening for.</td>
</tr>
<tr>
<td class="name"><code>listener</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The event listener function used in the on()
or once() call to cancel.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.js.html#line160">line 160</a>
</li></ul></dd>
</dl>
<h4 class="name" id=".off"><span class="type-signature">(static) </span>off<span class="signature">(event, listener)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Cancels the event listener for the passed event and listener function.
</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>event</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The event to cancel listener for.</td>
</tr>
<tr>
<td class="name"><code>listener</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The event listener function used in the on()
or once() call to cancel.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.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=".off"><span class="type-signature">(static) </span>off<span class="signature">(event)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Cancels all event listeners for the passed event.
</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>event</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The name of the event.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="Mixin.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.js.html#line97">line 97</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id=".on"><span class="type-signature">(static) </span>on<span class="signature">(event, id, listener)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Attach an event listener to the passed event only if the passed
id matches the document id for the event being fired.
</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>event</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The name of the event to listen for.</td>
</tr>
<tr>
<td class="name"><code>id</code></td>
<td class="type">
<span class="param-type">*</span>
</td>
<td class="description last">The document id to match against.</td>
</tr>
<tr>
<td class="name"><code>listener</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The method to call when the event 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.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.js.html#line29">line 29</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id=".on"><span class="type-signature">(static) </span>on<span class="signature">(event, listener)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Attach an event listener to the passed event.
</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>event</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The name of the event to listen for.</td>
</tr>
<tr>
<td class="name"><code>listener</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The method to call when the event 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.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.js.html#line12">line 12</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id=".once"><span class="type-signature">(static) </span>once<span class="signature">(event, id, listener)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Attach an event listener to the passed event that will be called only once.
</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>event</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The name of the event to listen for.</td>
</tr>
<tr>
<td class="name"><code>id</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The document id to match against.</td>
</tr>
<tr>
<td class="name"><code>listener</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The method to call when the event 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.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.js.html#line72">line 72</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">*</span>
</dd>
</dl>
<h4 class="name" id=".once"><span class="type-signature">(static) </span>once<span class="signature">(event, listener)</span><span class="type-signature"> → {*}</span></h4>
<div class="description">
Attach an event listener to the passed event that will be called only once.
</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>event</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last">The name of the event to listen for.</td>
</tr>
<tr>
<td class="name"><code>listener</code></td>
<td class="type">
<span class="param-type">function</span>
</td>
<td class="description last">The method to call when the event 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.Events.js.html">Mixin.Events.js</a>, <a href="Mixin.Events.js.html#line50">line 50</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="Collection.html">Collection</a></li><li><a href="CollectionGroup.html">CollectionGroup</a></li><li><a href="Condition.html">Condition</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="MyModule.html">MyModule</a></li><li><a href="NodeApiClient.html">NodeApiClient</a></li><li><a href="NodeApiServer.html">NodeApiServer</a></li><li><a href="NodeRAS.html">NodeRAS</a></li><li><a href="Odm.html">Odm</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="Overview.html">Overview</a></li><li><a href="Overview_init.html">init</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="Section.html">Section</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="Shared.html">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><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Thu Mar 01 2018 11:34:23 GMT+0000 (GMT)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>