docs/flux.html
<!DOCTYPE html>
<html>
<head>
<title>flux.js</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" media="all" href="docco.css" />
</head>
<body>
<div id="container">
<div id="background"></div>
<ul id="jump_to">
<li>
<a class="large" href="javascript:void(0);">Jump To …</a>
<a class="small" href="javascript:void(0);">+</a>
<div id="jump_wrapper">
<div id="jump_page">
<a class="source" href="src.html">
src.js
</a>
<a class="source" href="index.html">
index.js
</a>
<a class="source" href="flux.html">
flux.js
</a>
<a class="source" href="mvc.html">
mvc.js
</a>
</div>
</li>
</ul>
<ul class="sections">
<li id="title">
<div class="annotation">
<h1>flux.js</h1>
</div>
</li>
<li id="section-1">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-1">¶</a>
</div>
</div>
<div class="content"><div class='highlight'><pre>import {Kronicle} from <span class="hljs-string">'../build/Kronicle.js'</span>;
import {DataSource} from <span class="hljs-string">'../build/lib/DataSource.js'</span>;
import {DataSources} from <span class="hljs-string">'../build/lib/DataSources.js'</span>;
import {ArrayDataSource} from <span class="hljs-string">'../build/lib/ArrayDatasource'</span>;
import {View} from <span class="hljs-string">'../build/lib/View.js'</span>
<span class="hljs-keyword">var</span> dataSources = <span class="hljs-keyword">new</span> DataSources([<span class="hljs-keyword">new</span> DataSource(<span class="hljs-keyword">new</span> ArrayDataSource(), <span class="hljs-string">'ArrayDataSource'</span>)]);</pre></div></div>
</li>
<li id="section-2">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-2">¶</a>
</div>
<p>TODO: implement FLUX example in Kronicle6
ex: <a href="https://github.com/facebook/flux/blob/master/src/Dispatcher.js">https://github.com/facebook/flux/blob/master/src/Dispatcher.js</a></p>
</div>
<div class="content"><div class='highlight'><pre><span class="hljs-keyword">var</span> itemDispatcher = <span class="hljs-keyword">new</span> Dispatcher();
itemDispatcher.register((action) =>{
<span class="hljs-keyword">switch</span>(action){
<span class="hljs-keyword">case</span> actions.CREATE:
dataSources.sources.ArrayDataSource.create(<span class="hljs-string">'test'</span>, (err, item) =>{</pre></div></div>
</li>
<li id="section-3">
<div class="annotation">
<div class="pilwrap ">
<a class="pilcrow" href="#section-3">¶</a>
</div>
</div>
<div class="content"><div class='highlight'><pre> });
<span class="hljs-keyword">return</span>;
<span class="hljs-keyword">case</span> actions.UPDATE: <span class="hljs-keyword">return</span>;
<span class="hljs-keyword">case</span> actions.DELETE: <span class="hljs-keyword">return</span>;
<span class="hljs-keyword">case</span> actions.GET: <span class="hljs-keyword">return</span>;
<span class="hljs-keyword">default</span>: <span class="hljs-keyword">return</span>;
}
});
itemDispatcher.dispatch({
action: <span class="hljs-string">'CREATE'</span>,
item:item
});</pre></div></div>
</li>
</ul>
</div>
</body>
</html>