UNPKG

nx-event-bus

Version:

Simple JavaScript Event Bus Implementation

819 lines (187 loc) 9.09 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: EventListener</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: EventListener</h1> <section> <header> <h2><span class="attribs"><span class="type-signature"></span></span>EventListener<span class="signature">(channel, fn, scope, once)</span><span class="type-signature"></span></h2> <div class="class-description">Create an event listener object used to keep track of the listeners informations in one place</div> </header> <article> <div class="container-overview"> <h2>Constructor</h2> <h4 class="name" id="EventListener"><span class="type-signature"></span>new EventListener<span class="signature">(channel, fn, scope, once)</span><span class="type-signature"></span></h4> <div class="description"> Event Listener 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>channel</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">The channel on witch the events will be broadcast</td> </tr> <tr> <td class="name"><code>fn</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">The listener callback function</td> </tr> <tr> <td class="name"><code>scope</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">The listener scope</td> </tr> <tr> <td class="name"><code>once</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="description last">If it's a one time listener</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nx-event-bus.js.html">nx-event-bus.js</a>, <a href="nx-event-bus.js.html#line89">line 89</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Members</h3> <h4 class="name" id="channel"><span class="type-signature"></span>channel<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nx-event-bus.js.html">nx-event-bus.js</a>, <a href="nx-event-bus.js.html#line109">line 109</a> </li></ul></dd> </dl> <h4 class="name" id="fn"><span class="type-signature"></span>fn<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nx-event-bus.js.html">nx-event-bus.js</a>, <a href="nx-event-bus.js.html#line114">line 114</a> </li></ul></dd> </dl> <h4 class="name" id="once"><span class="type-signature"></span>once<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nx-event-bus.js.html">nx-event-bus.js</a>, <a href="nx-event-bus.js.html#line124">line 124</a> </li></ul></dd> </dl> <h4 class="name" id="scope"><span class="type-signature"></span>scope<span class="type-signature"></span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="nx-event-bus.js.html">nx-event-bus.js</a>, <a href="nx-event-bus.js.html#line119">line 119</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id="emit"><span class="type-signature"></span>emit<span class="signature">(event)</span><span class="type-signature"></span></h4> <div class="description"> Emit the event to the 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"><a href="BusEvent.html">BusEvent</a></span> </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="nx-event-bus.js.html">nx-event-bus.js</a>, <a href="nx-event-bus.js.html#line131">line 131</a> </li></ul></dd> </dl> <h4 class="name" id="is"><span class="type-signature"></span>is<span class="signature">(listener)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> Check if the given callback is the same as the listener ones </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>listener</code></td> <td class="type"> <span class="param-type">function</span> </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="nx-event-bus.js.html">nx-event-bus.js</a>, <a href="nx-event-bus.js.html#line142">line 142</a> </li></ul></dd> </dl> <h5>Returns:</h5> <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="BusEvent.html">BusEvent</a></li><li><a href="EventBus.html">EventBus</a></li><li><a href="EventListener.html">EventListener</a></li><li><a href="InvalidParameterGiven.html">InvalidParameterGiven</a></li></ul><h3>Global</h3><ul><li><a href="global.html#isFunction">isFunction</a></li><li><a href="global.html#toString">toString</a></li></ul> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sat Aug 18 2018 21:30:07 GMT+0100 (BST) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>