UNPKG

dormouse

Version:

Javascript API for Dormouse

39 lines (31 loc) 8.03 kB
<!DOCTYPE html> <html> <head> <title>assembler.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 &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="assembler.html"> assembler.coffee </a> <a class="source" href="connection.html"> connection.coffee </a> <a class="source" href="libutils.html"> libutils.coffee </a> <a class="source" href="mixin.html"> mixin.coffee </a> <a class="source" href="projects.html"> projects.coffee </a> <a class="source" href="query.html"> query.coffee </a> <a class="source" href="tasks.html"> tasks.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> assembler.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">&#182;</a> </div> <p><strong>dormousejs</strong> is a javascript library to help access the <a href="http://dormou.se">dormouse</a> crowdsourcing platform's API.</p> <p>It is compatible with the <strong>node.js</strong> engine, and can be installed in one line</p> <pre><code> npm install dormouse </code></pre> <p>It can also be used in <em>modern</em> <strong>browsers</strong> by including the bundled file found in <code>dist/dormouse.js</code></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">&#182;</a> </div> <h3>Features</h3> <ul> <li>Connects to specifiable dormouse server</li> <li>queues tasks</li> <li>receives responses</li> <li>Includes a <a href="query.html">task query API</a></li> <li>Rendering of task templates using the {{ <a href="http://mustache.github.com/">mustache.js</a> }} style</li> </ul> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <h3>First steps</h3> <ul> <li>If client-side, use the global <code>$dm</code> object</li> <li>If server-side, <code>require('dormouse')</code> to get the object</li> <li>Use the setter methods, <code>$dm.server(...)</code> and <code>$dm.api_key(...)</code> to access Dormouse</li> <li>Start playing with tasks from your favorite project using <code>$dm.getTasks(...)</code></li> </ul> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <h3>And now for code</h3> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>Requirements</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">require</span> <span class="s1">&#39;./mixin&#39;</span> <span class="nv">Connection = </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./connection&#39;</span><span class="p">).</span><span class="nx">Connection</span> <span class="nv">Tasks = </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./tasks&#39;</span><span class="p">).</span><span class="nx">Tasks</span> <span class="nv">Projects = </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;./projects&#39;</span><span class="p">).</span><span class="nx">Projects</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>This is accessed through <code>window.$dm</code> in the browser and <code>require('dormouse')</code> in node.js</p> <p>To see what other methods are available on the <code>dormouse</code> object look at <strong>tasks.coffee</strong> and <strong>projects.coffee</strong></p> </td> <td class="code"> <div class="highlight"><pre><span class="k">class</span> <span class="nx">Dormouse</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p>Tasks, Projects are <em>mixins</em></p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">@implements</span> <span class="nx">Tasks</span><span class="p">,</span> <span class="nx">Projects</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>get or set the <code>dormouse</code> server to connect to</p> </td> <td class="code"> <div class="highlight"><pre> <span class="vi">@server: </span><span class="nf">() -&gt;</span> <span class="nx">Connection</span><span class="p">.</span><span class="nx">server</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">Connection</span><span class="p">,</span> <span class="nx">arguments</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>get or set the <code>dormouse</code> api_key to identify the developer of the app</p> </td> <td class="code"> <div class="highlight"><pre> <span class="vi">@api_key: </span><span class="nf">() -&gt;</span> <span class="nx">Connection</span><span class="p">.</span><span class="nx">api_key</span><span class="p">.</span><span class="nx">apply</span> <span class="nx">Connection</span><span class="p">,</span> <span class="nx">arguments</span> <span class="nv">module.exports = </span><span class="nx">Dormouse</span> </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>