-
Notifications
You must be signed in to change notification settings - Fork 2
/
mock.html
17 lines (14 loc) · 5.71 KB
/
mock.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!DOCTYPE html> <html> <head> <title>mock.js</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="barricane-db.html"> barricane-db.js </a> <a class="source" href="bdb-disk-manager.html"> bdb-disk-manager.js </a> <a class="source" href="db.html"> db.js </a> <a class="source" href="disk-io.html"> disk-io.js </a> <a class="source" href="old-barricane-db.html"> old-barricane-db.js </a> <a class="source" href="serialisation.html"> serialisation.js </a> <a class="source" href="swoj-codec.html"> swoj-codec.js </a> <a class="source" href="util.html"> util.js </a> <a class="source" href="app-test.html"> app-test.js </a> <a class="source" href="demo-model.html"> demo-model.js </a> <a class="source" href="hello-world-test.html"> hello-world-test.js </a> <a class="source" href="mock.html"> mock.js </a> <a class="source" href="old-disk-manager.html"> old-disk-manager.js </a> <a class="source" href="old-serialisation.html"> old-serialisation.js </a> <a class="source" href="swoj-codec-test.html"> swoj-codec-test.js </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> mock.js </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>Copyright (c) 2010 Barricane Technology Ltd., All Rights Reserved.
Released under the MIT open source licence.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">¶</a> </div> <p>This source exists because the demo-model uses process.db to register its
instances and constructors.</p> </td> <td class="code"> <div class="highlight"><pre><span class="kd">function</span> <span class="nx">MockDB</span><span class="p">()</span> <span class="p">{</span>
<span class="p">}</span>
<span class="nx">MockDB</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">registerInstance</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">instance</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">instance</span><span class="p">[</span><span class="s2">"__uuid__"</span><span class="p">]</span> <span class="o">=</span> <span class="nx">mockUuid</span><span class="p">();</span>
<span class="p">};</span>
<span class="nx">MockDB</span><span class="p">.</span><span class="nx">prototype</span><span class="p">.</span><span class="nx">registerConstructors</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{};</span>
<span class="kd">var</span> <span class="nx">nextUuid</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
<span class="kd">function</span> <span class="nx">mockUuid</span><span class="p">()</span> <span class="p">{</span>
<span class="k">return</span> <span class="s2">""</span> <span class="o">+</span> <span class="nx">nextUuid</span><span class="o">++</span><span class="p">;</span>
<span class="p">}</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">¶</a> </div> <p>Export the MockDB in place of DB.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">exports</span><span class="p">.</span><span class="nx">DB</span> <span class="o">=</span> <span class="nx">MockDB</span><span class="p">;</span>
<span class="nx">exports</span><span class="p">.</span><span class="nx">uuid</span> <span class="o">=</span> <span class="nx">mockUuid</span><span class="p">;</span>
</pre></div> </td> </tr> </tbody> </table> </div> </body> </html>