UNPKG

marbles

Version:

Front-end framework for routing, http, and data handling

1,655 lines (464 loc) 19.4 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Class: Store</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: Store</h1> <section> <header> <h2> <span class="ancestors"><a href="Marbles.html">Marbles</a>.</span> Store </h2> </header> <article> <div class="container-overview"> <dt> <h4 class="name" id="Store"><span class="type-signature"></span>new Store<span class="signature">(id)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> This class is meant to be sub-classed using Store.createClass </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">*</span> </td> <td class="description last">Anything serializable as JSON</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line458">line 458</a> </li></ul></dd> </dl> </dd> </div> <h3 class="subsection-title">Members</h3> <dl> <dt> <h4 class="name" id="Store.dispatcherIndex"><span class="type-signature">(static) </span>Store.dispatcherIndex<span class="type-signature"></span></h4> </dt> <dd> <dl class="details"> <h5 class="subsection-title">Properties:</h5> <dl> <table class="props"> <thead> <tr> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="type"> <span class="param-type">Number</span> </td> <td class="description last"></td> </tr> </tbody> </table></dl> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line648">line 648</a> </li></ul></dd> </dl> </dd> </dl> <h3 class="subsection-title">Methods</h3> <dl> <dt> <h4 class="name" id="Store.addChangeListener"><span class="type-signature">(static) </span>Store.addChangeListener<span class="signature">(id)</span><span class="type-signature"></span></h4> </dt> <dd> <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">Store#id</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="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line603">line 603</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="Store.createClass"><span class="type-signature">(static) </span>Store.createClass<span class="signature">(proto)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Creates a new class that inherits from Store </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>proto</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Prototype of new child class</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line718">line 718</a> </li></ul></dd> </dl> <h5>Example</h5> <pre class="prettyprint"><code>var MyStore = Marbles.Store.createClass({ displayName: "MyStore", getInitialState: function () { return { my: "state" }; }, willInitialize: function () { // do something }, didInitialize: function () { // do something }, didBecomeActive: function () { // do something }, didBecomeInactive: function () { // do something }, handleEvent: function (event) { // do something } });</code></pre> </dd> <dt> <h4 class="name" id="Store.discardInstance"><span class="type-signature">(static) </span>Store.discardInstance<span class="signature">(store)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Give Store instance up for garbage collection </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>store</code></td> <td class="type"> <span class="param-type"><a href="Marbles.Store.html">Marbles.Store</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="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line593">line 593</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="Store.expectChangeListener"><span class="type-signature">(static) </span>Store.expectChangeListener<span class="signature">(id)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Force store to remain active until the next change listener is added </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">Store#id</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="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line624">line 624</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="Store.registerWithDispatcher"><span class="type-signature">(static) </span>Store.registerWithDispatcher<span class="signature">(dispatcher)</span><span class="type-signature"></span></h4> </dt> <dd> <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>dispatcher</code></td> <td class="type"> <span class="param-type"><a href="Marbles.Dispatcher.html">Marbles.Dispatcher</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="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line655">line 655</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="Store.removeChangeListener"><span class="type-signature">(static) </span>Store.removeChangeListener<span class="signature">(id)</span><span class="type-signature"></span></h4> </dt> <dd> <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">Store#id</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="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line613">line 613</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="Store.unexpectChangeListener"><span class="type-signature">(static) </span>Store.unexpectChangeListener<span class="signature">(id)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Undo expectation from expectChangeListener </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">Store#id</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="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line637">line 637</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="didBecomeActive"><span class="type-signature"></span>didBecomeActive<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Called when first change listener is added </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line506">line 506</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="didBecomeInactive"><span class="type-signature"></span>didBecomeInactive<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Called when last change listener is removed and when the instance is otherwise perceived as inactive </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line514">line 514</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="didInitialize"><span class="type-signature"></span>didInitialize<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Called after state is initialized </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line498">line 498</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="getInitialState"><span class="type-signature"></span>getInitialState<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4> </dt> <dd> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line480">line 480</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Initial state object </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> </dd> <dt> <h4 class="name" id="handleEvent"><span class="type-signature"></span>handleEvent<span class="signature">(event)</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Called with Dispatcher events </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">Object</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="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line523">line 523</a> </li></ul></dd> </dl> </dd> <dt> <h4 class="name" id="willInitialize"><span class="type-signature"></span>willInitialize<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> Called before state is initialized </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="marbles.js.html">marbles.js</a>, <a href="marbles.js.html#line490">line 490</a> </li></ul></dd> </dl> </dd> </dl> </article> </section> </div> <nav> <h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Marbles.Collection.html">Collection</a></li><li><a href="Marbles.History.html">History</a></li><li><a href="Marbles.HTTPRequest.html">HTTPRequest</a></li><li><a href="Marbles.Model.html">Model</a></li><li><a href="Marbles.Object.html">Object</a></li><li><a href="Marbles.Router.html">Router</a></li><li><a href="Marbles.Store.html">Store</a></li></ul><h3>Namespaces</h3><ul><li><a href="Marbles.html">Marbles</a></li><li><a href="Marbles.HTTP.Middleware.html">Middleware</a></li><li><a href="Marbles.Utils.html">Utils</a></li></ul><h3>Mixins</h3><ul><li><a href="Marbles.Accessors.html">Accessors</a></li><li><a href="Marbles.Dispatcher.html">Dispatcher</a></li><li><a href="Marbles.Events.html">Events</a></li><li><a href="Marbles.HTTP.LinkHeader.html">LinkHeader</a></li><li><a href="Marbles.QueryParams.html">QueryParams</a></li><li><a href="Marbles.State.html">State</a></li></ul> </nav> <br clear="both"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha9</a> on Fri Jan 09 2015 21:26:15 GMT-0500 (EST) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>