forked from meltingice/CamanJS
/
store.html
14 lines (11 loc) · 6.01 KB
/
store.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html> <html> <head> <title>store.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To … <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="blender.html"> blender.coffee </a> <a class="source" href="calculate.html"> calculate.coffee </a> <a class="source" href="caman.html"> caman.coffee </a> <a class="source" href="camaninstance.html"> camaninstance.coffee </a> <a class="source" href="convert.html"> convert.coffee </a> <a class="source" href="event.html"> event.coffee </a> <a class="source" href="filter.html"> filter.coffee </a> <a class="source" href="io.html"> io.coffee </a> <a class="source" href="layer.html"> layer.coffee </a> <a class="source" href="logger.html"> logger.coffee </a> <a class="source" href="pixelinfo.html"> pixelinfo.coffee </a> <a class="source" href="plugin.html"> plugin.coffee </a> <a class="source" href="renderjob.html"> renderjob.coffee </a> <a class="source" href="store.html"> store.coffee </a> <a class="source" href="util.html"> util.coffee </a> <a class="source" href="blenders.html"> blenders.coffee </a> <a class="source" href="filters.html"> filters.coffee </a> <a class="source" href="blur.html"> blur.coffee </a> <a class="source" href="camera.html"> camera.coffee </a> <a class="source" href="compoundBlur.html"> compoundBlur.coffee </a> <a class="source" href="edges.html"> edges.coffee </a> <a class="source" href="posterize.html"> posterize.coffee </a> <a class="source" href="presets.html"> presets.coffee </a> <a class="source" href="stackBlur.html"> stackBlur.coffee </a> <a class="source" href="threshold.html"> threshold.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> store.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">¶</a> </div> <p>Used for storing instances of CamanInstance objects such that, when Caman() is called on an
already initialized element, it returns that object instead of re-initializing.</p> </td> <td class="code"> <div class="highlight"><pre><span class="k">class</span> <span class="nx">Store</span>
<span class="vi">@items = </span><span class="p">{}</span>
<span class="vi">@has: </span><span class="nf">(search) -></span> <span class="nx">@items</span><span class="p">[</span><span class="nx">search</span><span class="p">]</span><span class="o">?</span>
<span class="vi">@get: </span><span class="nf">(search) -></span> <span class="nx">@items</span><span class="p">[</span><span class="nx">search</span><span class="p">]</span>
<span class="vi">@put: </span><span class="nf">(name, obj) -></span> <span class="nx">@items</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span> <span class="o">=</span> <span class="nx">obj</span>
<span class="vi">@execute: </span><span class="nf">(search, callback) -></span> <span class="nx">callback</span><span class="p">.</span><span class="nx">call</span> <span class="nx">@get</span><span class="p">(</span><span class="nx">search</span><span class="p">),</span> <span class="nx">@get</span><span class="p">(</span><span class="nx">search</span><span class="p">)</span>
<span class="vi">@flush: </span><span class="nf">(name = false) -></span>
<span class="k">if</span> <span class="nx">name</span> <span class="k">then</span> <span class="k">delete</span> <span class="nx">@items</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span> <span class="k">else</span> <span class="vi">@items = </span><span class="p">{}</span>
<span class="nv">Caman.Store = </span><span class="nx">Store</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>