Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update the doc

  • Loading branch information...
commit 90a2d95fb68597b972c72fe62b0091a8d0f1a0a0 1 parent e59cf62
Peter Qian authored ericz committed
Showing with 1,870 additions and 43 deletions.
  1. BIN  doc/jsdoc/.DS_Store
  2. +13 −13 doc/jsdoc/files.html
  3. +2 −2 doc/jsdoc/index.html
  4. BIN  doc/jsdoc/symbols/.DS_Store
  5. BIN  doc/jsdoc/symbols/.User#user.html.swp
  6. +3 −3 doc/jsdoc/symbols/Group#now.html
  7. +3 −3 doc/jsdoc/symbols/Group.html
  8. +3 −3 doc/jsdoc/symbols/User#now.html
  9. +3 −3 doc/jsdoc/symbols/User#user.html
  10. +3 −3 doc/jsdoc/symbols/User.html
  11. +45 −8 doc/jsdoc/symbols/_global_.html
  12. +105 −5 doc/jsdoc/symbols/nowjs.html
  13. BIN  doc/jsdoc/symbols/src/.DS_Store
  14. +136 −0 doc/jsdoc/symbols/src/now_lib_fileServer.js.html
  15. +59 −0 doc/jsdoc/symbols/src/now_lib_function.js.html
  16. +342 −0 doc/jsdoc/symbols/src/now_lib_group.js.html
  17. +165 −0 doc/jsdoc/symbols/src/now_lib_handlers.js.html
  18. +288 −0 doc/jsdoc/symbols/src/now_lib_now.js.html
  19. +173 −0 doc/jsdoc/symbols/src/now_lib_nowUtil.js.html
  20. +81 −0 doc/jsdoc/symbols/src/now_lib_proxy.js.html
  21. +72 −0 doc/jsdoc/symbols/src/now_lib_scopeTable.js.html
  22. +15 −0 doc/jsdoc/symbols/src/now_lib_server.js.html
  23. +110 −0 doc/jsdoc/symbols/src/now_lib_support.js.html
  24. +249 −0 doc/jsdoc/symbols/src/now_lib_user.js.html
View
BIN  doc/jsdoc/.DS_Store
Binary file not shown
View
26 doc/jsdoc/files.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="content-type" content="text/html; charset=utf8" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>JsDoc Reference - File Index</title>
<meta name="generator" content="JsDoc Toolkit" />
@@ -207,7 +207,7 @@ <h1 class="classTitle">File Index</h1>
<div>
- <h2><a href="symbols/src/flotype_now_lib_fileServer.js.html">../flotype/now/lib/fileServer.js</a></h2>
+ <h2><a href="symbols/src/now_lib_fileServer.js.html">../../../now/lib/fileServer.js</a></h2>
<dl>
@@ -219,7 +219,7 @@ <h1 class="classTitle">File Index</h1>
<hr />
<div>
- <h2><a href="symbols/src/flotype_now_lib_function.js.html">../flotype/now/lib/function.js</a></h2>
+ <h2><a href="symbols/src/now_lib_function.js.html">../../../now/lib/function.js</a></h2>
<dl>
@@ -231,7 +231,7 @@ <h1 class="classTitle">File Index</h1>
<hr />
<div>
- <h2><a href="symbols/src/flotype_now_lib_group.js.html">../flotype/now/lib/group.js</a></h2>
+ <h2><a href="symbols/src/now_lib_group.js.html">../../../now/lib/group.js</a></h2>
<dl>
@@ -243,7 +243,7 @@ <h1 class="classTitle">File Index</h1>
<hr />
<div>
- <h2><a href="symbols/src/flotype_now_lib_handlers.js.html">../flotype/now/lib/handlers.js</a></h2>
+ <h2><a href="symbols/src/now_lib_handlers.js.html">../../../now/lib/handlers.js</a></h2>
<dl>
@@ -255,7 +255,7 @@ <h1 class="classTitle">File Index</h1>
<hr />
<div>
- <h2><a href="symbols/src/flotype_now_lib_now.js.html">../flotype/now/lib/now.js</a></h2>
+ <h2><a href="symbols/src/now_lib_now.js.html">../../../now/lib/now.js</a></h2>
<dl>
@@ -267,7 +267,7 @@ <h1 class="classTitle">File Index</h1>
<hr />
<div>
- <h2><a href="symbols/src/flotype_now_lib_nowUtil.js.html">../flotype/now/lib/nowUtil.js</a></h2>
+ <h2><a href="symbols/src/now_lib_nowUtil.js.html">../../../now/lib/nowUtil.js</a></h2>
<dl>
@@ -279,7 +279,7 @@ <h1 class="classTitle">File Index</h1>
<hr />
<div>
- <h2><a href="symbols/src/flotype_now_lib_proxy.js.html">../flotype/now/lib/proxy.js</a></h2>
+ <h2><a href="symbols/src/now_lib_proxy.js.html">../../../now/lib/proxy.js</a></h2>
<dl>
@@ -291,7 +291,7 @@ <h1 class="classTitle">File Index</h1>
<hr />
<div>
- <h2><a href="symbols/src/flotype_now_lib_scopeTable.js.html">../flotype/now/lib/scopeTable.js</a></h2>
+ <h2><a href="symbols/src/now_lib_scopeTable.js.html">../../../now/lib/scopeTable.js</a></h2>
<dl>
@@ -303,7 +303,7 @@ <h1 class="classTitle">File Index</h1>
<hr />
<div>
- <h2><a href="symbols/src/flotype_now_lib_server.js.html">../flotype/now/lib/server.js</a></h2>
+ <h2><a href="symbols/src/now_lib_server.js.html">../../../now/lib/server.js</a></h2>
<dl>
@@ -315,7 +315,7 @@ <h1 class="classTitle">File Index</h1>
<hr />
<div>
- <h2><a href="symbols/src/flotype_now_lib_support.js.html">../flotype/now/lib/support.js</a></h2>
+ <h2><a href="symbols/src/now_lib_support.js.html">../../../now/lib/support.js</a></h2>
<dl>
@@ -327,7 +327,7 @@ <h1 class="classTitle">File Index</h1>
<hr />
<div>
- <h2><a href="symbols/src/flotype_now_lib_user.js.html">../flotype/now/lib/user.js</a></h2>
+ <h2><a href="symbols/src/now_lib_user.js.html">../../../now/lib/user.js</a></h2>
<dl>
@@ -342,7 +342,7 @@ <h1 class="classTitle">File Index</h1>
</div>
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Tue Aug 16 2011 17:09:04 GMT-0700 (PDT)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Tue Jan 03 2012 15:53:12 GMT-0800 (PST)
</div>
</body>
</html>
View
4 doc/jsdoc/index.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="content-type" content="text/html; charset=utf8" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>JsDoc Reference - Index</title>
<meta name="generator" content="JsDoc Toolkit" />
@@ -256,7 +256,7 @@ <h1 class="classTitle">Class Index</h1>
</div>
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Tue Aug 16 2011 17:09:04 GMT-0700 (PDT)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> 2.4.0 on Tue Jan 03 2012 15:53:12 GMT-0800 (PST)
</div>
</body>
</html>
View
BIN  doc/jsdoc/symbols/.DS_Store
Binary file not shown
View
BIN  doc/jsdoc/symbols/.User#user.html.swp
Binary file not shown
View
6 doc/jsdoc/symbols/Group#now.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="content-type" content="text/html; charset=utf8" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="generator" content="JsDoc Toolkit" />
<title>JsDoc Reference - Group#now</title>
@@ -226,7 +226,7 @@ <h1 class="classTitle">
context of each individual user in the group.
- <br /><i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_group.js.html">group.js</a>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/now_lib_group.js.html">group.js</a>.
</p>
@@ -316,7 +316,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Aug 16 2011 17:09:04 GMT-0700 (PDT)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Jan 03 2012 15:53:12 GMT-0800 (PST)
</div>
</body>
</html>
View
6 doc/jsdoc/symbols/Group.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="content-type" content="text/html; charset=utf8" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="generator" content="JsDoc Toolkit" />
<title>JsDoc Reference - Group</title>
@@ -224,7 +224,7 @@ <h1 class="classTitle">
users. Each group has its own <a href="../symbols/Group%23now.html">Group#now</a> namespace.
- <br /><i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_group.js.html">group.js</a>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/now_lib_group.js.html">group.js</a>.
</p>
@@ -1016,7 +1016,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Aug 16 2011 17:09:04 GMT-0700 (PDT)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Jan 03 2012 15:53:12 GMT-0800 (PST)
</div>
</body>
</html>
View
6 doc/jsdoc/symbols/User#now.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="content-type" content="text/html; charset=utf8" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="generator" content="JsDoc Toolkit" />
<title>JsDoc Reference - User#now</title>
@@ -225,7 +225,7 @@ <h1 class="classTitle">
only be executed for the current user.
- <br /><i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_user.js.html">user.js</a>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/now_lib_user.js.html">user.js</a>.
</p>
@@ -324,7 +324,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Aug 16 2011 17:09:04 GMT-0700 (PDT)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Jan 03 2012 15:53:12 GMT-0800 (PST)
</div>
</body>
</html>
View
6 doc/jsdoc/symbols/User#user.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="content-type" content="text/html; charset=utf8" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="generator" content="JsDoc Toolkit" />
<title>JsDoc Reference - User#user</title>
@@ -225,7 +225,7 @@ <h1 class="classTitle">
connected user.
- <br /><i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_user.js.html">user.js</a>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/now_lib_user.js.html">user.js</a>.
</p>
@@ -405,7 +405,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Aug 16 2011 17:09:04 GMT-0700 (PDT)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Jan 03 2012 15:53:12 GMT-0800 (PST)
</div>
</body>
</html>
View
6 doc/jsdoc/symbols/User.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="content-type" content="text/html; charset=utf8" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="generator" content="JsDoc Toolkit" />
<title>JsDoc Reference - User</title>
@@ -227,7 +227,7 @@ <h1 class="classTitle">
and <a href="../symbols/User%23user.html">User#user</a> namespaces.
- <br /><i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_user.js.html">user.js</a>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/now_lib_user.js.html">user.js</a>.
</p>
@@ -458,7 +458,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Aug 16 2011 17:09:04 GMT-0700 (PDT)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Jan 03 2012 15:53:12 GMT-0800 (PST)
</div>
</body>
</html>
View
53 doc/jsdoc/symbols/_global_.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="content-type" content="text/html; charset=utf8" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="generator" content="JsDoc Toolkit" />
<title>JsDoc Reference - _global_</title>
@@ -254,6 +254,17 @@ <h1 class="classTitle">
</td>
</tr>
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont">
+ <b><a href="../symbols/_global_.html#util">util</a></b>
+ </div>
+ <div class="description">NowUtil: an assorted collection of general-purpose functions used
+in NowJS.</div>
+ </td>
+ </tr>
+
</tbody>
</table>
@@ -353,7 +364,33 @@ <h1 class="classTitle">
trigger the store function to be called.
<br />
- <i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_proxy.js.html">proxy.js</a>.
+ <i>Defined in: </i> <a href="../symbols/src/now_lib_proxy.js.html">proxy.js</a>.
+
+
+ </div>
+
+
+
+
+
+
+
+
+ <hr />
+
+ <a name="util"> </a>
+ <div class="fixedFont">
+
+
+ <b>util</b>
+
+ </div>
+ <div class="description">
+ NowUtil: an assorted collection of general-purpose functions used
+in NowJS.
+
+ <br />
+ <i>Defined in: </i> <a href="../symbols/src/now_lib_nowUtil.js.html">nowUtil.js</a>.
</div>
@@ -386,7 +423,7 @@ <h1 class="classTitle">
<br />
- <i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_fileServer.js.html">fileServer.js</a>.
+ <i>Defined in: </i> <a href="../symbols/src/now_lib_fileServer.js.html">fileServer.js</a>.
</div>
@@ -437,7 +474,7 @@ <h1 class="classTitle">
<br />
- <i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_fileServer.js.html">fileServer.js</a>.
+ <i>Defined in: </i> <a href="../symbols/src/now_lib_fileServer.js.html">fileServer.js</a>.
</div>
@@ -482,7 +519,7 @@ <h1 class="classTitle">
<br />
- <i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_now.js.html">now.js</a>.
+ <i>Defined in: </i> <a href="../symbols/src/now_lib_now.js.html">now.js</a>.
</div>
@@ -510,7 +547,7 @@ <h1 class="classTitle">
<br />
- <i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_scopeTable.js.html">scopeTable.js</a>.
+ <i>Defined in: </i> <a href="../symbols/src/now_lib_scopeTable.js.html">scopeTable.js</a>.
</div>
@@ -549,7 +586,7 @@ <h1 class="classTitle">
<br />
- <i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_fileServer.js.html">fileServer.js</a>.
+ <i>Defined in: </i> <a href="../symbols/src/now_lib_fileServer.js.html">fileServer.js</a>.
</div>
@@ -607,7 +644,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Aug 16 2011 17:09:04 GMT-0700 (PDT)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Jan 03 2012 15:53:12 GMT-0800 (PST)
</div>
</body>
</html>
View
110 doc/jsdoc/symbols/nowjs.html
@@ -2,7 +2,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
- <meta http-equiv="content-type" content="text/html; charset=utf8" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="generator" content="JsDoc Toolkit" />
<title>JsDoc Reference - nowjs</title>
@@ -223,7 +223,7 @@ <h1 class="classTitle">
- <br /><i>Defined in: </i> <a href="../symbols/src/flotype_now_lib_now.js.html">now.js</a>.
+ <br /><i>Defined in: </i> <a href="../symbols/src/now_lib_now.js.html">now.js</a>.
</p>
@@ -308,6 +308,15 @@ <h1 class="classTitle">
</td>
</tr>
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/nowjs.html#removeGroup">removeGroup</a></b>(name)
+ </div>
+ <div class="description">Removes all traces of a group.</div>
+ </td>
+ </tr>
+
</tbody>
</table>
@@ -377,6 +386,15 @@ <h1 class="classTitle">
</td>
</tr>
+ <tr>
+ <td class="attributes">&nbsp;</td>
+ <td class="nameDescription">
+ <div class="fixedFont"><b><a href="../symbols/nowjs.html#event:removegroup">removegroup</a></b>(group)
+ </div>
+ <div class="description">Called when a group is removed.</div>
+ </td>
+ </tr>
+
</tbody>
</table>
@@ -612,6 +630,46 @@ <h1 class="classTitle">
+ <hr />
+
+ <a name="removeGroup"> </a>
+ <div class="fixedFont">
+
+ <span class="light">{<a href="../symbols/Group.html">Group</a>}</span>
+ <b>removeGroup</b>(name)
+
+ </div>
+ <div class="description">
+ Removes all traces of a group.
+
+
+ </div>
+
+
+
+ <pre class="code">var new_group = nowjs.getGroup('a new group');</pre>
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Parameters:</dt>
+
+ <dt>
+ <span class="light fixedFont">{String}</span> <b>name</b>
+
+ </dt>
+ <dd>The name of the group to be retrieved.</dd>
+
+ </dl>
+
+
+
+
+
+
+
+
@@ -797,8 +855,8 @@ <h1 class="classTitle">
- <pre class="code">nowjs.on('newgroup', function (name) {
- console.log('You have successfully created the group `' + name + '`');
+ <pre class="code">nowjs.on('newgroup', function (group) {
+ console.log('You have successfully created the group `' + group.groupName + '`');
});</pre>
@@ -822,6 +880,48 @@ <h1 class="classTitle">
+ <hr />
+
+ <a name="event:removegroup"> </a>
+ <div class="fixedFont">
+
+
+ <b>removegroup</b>(group)
+
+ </div>
+ <div class="description">
+ Called when a group is removed.
+
+
+ </div>
+
+
+
+ <pre class="code">nowjs.on('removegroup', function (group) {
+ console.log('Group `' + group.groupName + '` eliminated from existence.');
+});</pre>
+
+
+
+
+ <dl class="detailList">
+ <dt class="heading">Parameters:</dt>
+
+ <dt>
+ <span class="light fixedFont">{<a href="../symbols/Group.html">Group</a>}</span> <b>group</b>
+
+ </dt>
+ <dd>The group removed by <a href="../symbols/nowjs.html#getGroup">nowjs#getGroup</a>.</dd>
+
+ </dl>
+
+
+
+
+
+
+
+
@@ -833,7 +933,7 @@ <h1 class="classTitle">
<!-- ============================== footer ================================= -->
<div class="fineprint" style="clear:both">
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Aug 16 2011 17:09:04 GMT-0700 (PDT)
+ Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> 2.4.0 on Tue Jan 03 2012 15:53:12 GMT-0800 (PST)
</div>
</body>
</html>
View
BIN  doc/jsdoc/symbols/src/.DS_Store
Binary file not shown
View
136 doc/jsdoc/symbols/src/now_lib_fileServer.js.html
@@ -0,0 +1,136 @@
+<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
+ .KEYW {color: #933;}
+ .COMM {color: #bbb; font-style: italic;}
+ .NUMB {color: #393;}
+ .STRN {color: #393;}
+ .REGX {color: #339;}
+ .line {border-right: 1px dotted #666; color: #666; font-style: normal;}
+ </style></head><body><pre><span class='line'> 1</span> <span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">require</span><span class="PUNC">(</span><span class="STRN">'fs'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 2</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nowUtil</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">require</span><span class="PUNC">(</span><span class="STRN">'./nowUtil'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">nowUtil</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 3</span> </span><span class="COMM">//redirect the client/now.js to ../dist/now.min.js</span><span class="WHIT">
+<span class='line'> 4</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">clientNow</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'/dist/now.js'</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 5</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fileCache</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 6</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nowFileCache</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 7</span>
+<span class='line'> 8</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">defaultListeners</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 9</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">server</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 10</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">options</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 11</span>
+<span class='line'> 12</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">handleResponse</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">serveFile</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">generateClientLibs</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 13</span>
+<span class='line'> 14</span> </span><span class="NAME">exports.wrapServer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">httpServer</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">serverOptions</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="NAME">server</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">httpServer</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="NAME">options</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">serverOptions</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">client</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="NAME">options.client</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">JSON.stringify</span><span class="PUNC">(</span><span class="NAME">options.client</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 18</span>
+<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="NAME">defaultListeners</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">server.listeners</span><span class="PUNC">(</span><span class="STRN">'request'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">serverOptions.autoHost</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">server.removeAllListeners</span><span class="PUNC">(</span><span class="STRN">'request'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="NAME">server.on</span><span class="PUNC">(</span><span class="STRN">'request'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">handleResponse</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 24</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 25</span>
+<span class='line'> 26</span> </span><span class="COMM">// Called upon http server request</span><span class="WHIT">
+<span class='line'> 27</span> </span><span class="NAME">handleResponse</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">request</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">response</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="COMM">// Handle only GET requests for /nowjs/* files. Pass all other requests through</span><span class="WHIT">
+<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">request.method</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'GET'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 31</span>
+<span class='line'> 32</span> </span><span class="WHIT"> </span><span class="COMM">// Detect if request involves the now.js file</span><span class="WHIT">
+<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">request.url.split</span><span class="PUNC">(</span><span class="STRN">'?'</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'/nowjs/now.js'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="NAME">serveFile</span><span class="PUNC">(</span><span class="NAME">__dirname</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">clientNow</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">request</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">response</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 37</span> </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">err</span><span class="PUNC">)</span><span class="WHIT">
+<span class='line'> 38</span> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"/client/now.js not found, while serving file"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 42</span> </span><span class="WHIT">
+<span class='line'> 43</span> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="COMM">// Make sure default listeners are still handled</span><span class="WHIT">
+<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">defaultListeners</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nowUtil.hasProperty</span><span class="PUNC">(</span><span class="NAME">defaultListeners</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="NAME">defaultListeners</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">call</span><span class="PUNC">(</span><span class="NAME">server</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">request</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">response</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 51</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 52</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">defaultListeners</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 53</span> </span><span class="WHIT"> </span><span class="COMM">// Make sure default listeners are still handled</span><span class="WHIT">
+<span class='line'> 54</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nowUtil.hasProperty</span><span class="PUNC">(</span><span class="NAME">defaultListeners</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 55</span> </span><span class="WHIT"> </span><span class="NAME">defaultListeners</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">call</span><span class="PUNC">(</span><span class="NAME">server</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">request</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">response</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 56</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 57</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 58</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 59</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 60</span>
+<span class='line'> 61</span> </span><span class="COMM">// Actually serve the file</span><span class="WHIT">
+<span class='line'> 62</span> </span><span class="NAME">serveFile</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">filename</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">request</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">response</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">options</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 63</span> </span><span class="WHIT"> </span><span class="COMM">// Write file from cache if possible</span><span class="WHIT">
+<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nowUtil.hasProperty</span><span class="PUNC">(</span><span class="NAME">fileCache</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">filename</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 65</span> </span><span class="WHIT"> </span><span class="NAME">response.writeHead</span><span class="PUNC">(</span><span class="NUMB">200</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 66</span> </span><span class="WHIT"> </span><span class="NAME">response.write</span><span class="PUNC">(</span><span class="NAME">fileCache</span><span class="PUNC">[</span><span class="NAME">filename</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 67</span> </span><span class="WHIT"> </span><span class="NAME">response.end</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 68</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 69</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">filename.indexOf</span><span class="PUNC">(</span><span class="STRN">'/now.js'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 70</span>
+<span class='line'> 71</span> </span><span class="WHIT"> </span><span class="COMM">// Write file from cache if possible</span><span class="WHIT">
+<span class='line'> 72</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nowUtil.hasProperty</span><span class="PUNC">(</span><span class="NAME">nowFileCache</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">request.headers.host</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 73</span>
+<span class='line'> 74</span> </span><span class="WHIT"> </span><span class="COMM">// Write file from cache</span><span class="WHIT">
+<span class='line'> 75</span> </span><span class="WHIT"> </span><span class="NAME">response.writeHead</span><span class="PUNC">(</span><span class="NUMB">200</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'Content-Type'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'text/javascript'</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 76</span> </span><span class="WHIT"> </span><span class="NAME">response.write</span><span class="PUNC">(</span><span class="NAME">nowFileCache</span><span class="PUNC">[</span><span class="NAME">request.headers.host</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">now</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 77</span> </span><span class="WHIT"> </span><span class="NAME">response.end</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 78</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 79</span> </span><span class="WHIT"> </span><span class="COMM">// Determine hostname / port if not given in options</span><span class="WHIT">
+<span class='line'> 80</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">host</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">request.headers.host.split</span><span class="PUNC">(</span><span class="STRN">':'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hostServer</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options</span><span class="PUNC">[</span><span class="STRN">'host'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">host</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">hostPort</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options</span><span class="PUNC">[</span><span class="STRN">'port'</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">host</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">'80'</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 83</span>
+<span class='line'> 84</span> </span><span class="WHIT"> </span><span class="COMM">// Call generate client libs, which takes the desired host/port and executes callback with two parts of now.js as parameters</span><span class="WHIT">
+<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="NAME">generateClientLibs</span><span class="PUNC">(</span><span class="NAME">hostServer</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">hostPort</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nowText</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 86</span>
+<span class='line'> 87</span> </span><span class="WHIT"> </span><span class="COMM">// Write to client</span><span class="WHIT">
+<span class='line'> 88</span> </span><span class="WHIT"> </span><span class="NAME">response.writeHead</span><span class="PUNC">(</span><span class="NUMB">200</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'Content-Type'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'text/javascript'</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 89</span> </span><span class="WHIT"> </span><span class="NAME">response.write</span><span class="PUNC">(</span><span class="NAME">nowText</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 90</span> </span><span class="WHIT"> </span><span class="NAME">response.end</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 91</span>
+<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="COMM">// Add to cache</span><span class="WHIT">
+<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="NAME">nowFileCache</span><span class="PUNC">[</span><span class="NAME">request.headers.host</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">now</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">nowText</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 94</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 96</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 97</span> </span><span class="WHIT"> </span><span class="COMM">// For any other filename, read file and server (not cached)</span><span class="WHIT">
+<span class='line'> 98</span> </span><span class="WHIT"> </span><span class="NAME">fs.readFile</span><span class="PUNC">(</span><span class="NAME">filename</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">err</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 99</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">text</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>100</span> </span><span class="WHIT"> </span><span class="NAME">response.writeHead</span><span class="PUNC">(</span><span class="NUMB">200</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>101</span> </span><span class="WHIT"> </span><span class="NAME">response.write</span><span class="PUNC">(</span><span class="NAME">text</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>102</span> </span><span class="WHIT"> </span><span class="NAME">response.end</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>103</span> </span><span class="WHIT"> </span><span class="NAME">fileCache</span><span class="PUNC">[</span><span class="NAME">filename</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">text</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>104</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>105</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>106</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>107</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>108</span>
+<span class='line'>109</span> </span><span class="COMM">// Takes host and port and call callback with now.js as parameter</span><span class="WHIT">
+<span class='line'>110</span> </span><span class="NAME">generateClientLibs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hostServer</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">hostPort</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>111</span> </span><span class="WHIT"> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>112</span> </span><span class="WHIT"> </span><span class="NAME">fs.readFile</span><span class="PUNC">(</span><span class="NAME">__dirname</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">clientNow</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">err</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>113</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nowText</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>114</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">initString</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">options.scope</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'.now = nowInitialize("'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
+<span class='line'>115</span> </span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">options.protocol</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">options.protocol</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
+<span class='line'>116</span> </span><span class="WHIT"> </span><span class="STRN">'//'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">hostServer</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">':'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">hostPort</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'", '</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">options.client</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">');\n'</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>117</span> </span><span class="WHIT"> </span><span class="NAME">nowText</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">initString</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>118</span>
+<span class='line'>119</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">nowText</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>120</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>121</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">err</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>122</span> </span><span class="WHIT"> </span><span class="NAME">console.log</span><span class="PUNC">(</span><span class="STRN">"/client/now.js not found while reading file"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>123</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>124</span> </span><span class="WHIT">
+<span class='line'>125</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>126</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>127</span>
+<span class='line'>128</span> </span><span class="NAME">exports.generateClientLibs</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">generateClientLibs</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>129</span> </span></pre></body></html>
View
59 doc/jsdoc/symbols/src/now_lib_function.js.html
@@ -0,0 +1,59 @@
+<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
+ .KEYW {color: #933;}
+ .COMM {color: #bbb; font-style: italic;}
+ .NUMB {color: #393;}
+ .STRN {color: #393;}
+ .REGX {color: #339;}
+ .line {border-right: 1px dotted #666; color: #666; font-style: normal;}
+ </style></head><body><pre><span class='line'> 1</span> <span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nowUtil</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">require</span><span class="PUNC">(</span><span class="STRN">'./nowUtil'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">nowUtil</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 2</span>
+<span class='line'> 3</span> </span><span class="NAME">exports.init</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nowjs</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 4</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 5</span> </span><span class="WHIT"> </span><span class="NAME">multicall</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 6</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nowUtil.clone</span><span class="PUNC">(</span><span class="NAME">Array.prototype</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 7</span> </span><span class="WHIT"> </span><span class="NAME">nowjs.emit</span><span class="PUNC">(</span><span class="STRN">'multicall'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 8</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'> 9</span>
+<span class='line'> 10</span> </span><span class="WHIT"> </span><span class="NAME">remotecall</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 11</span> </span><span class="WHIT"> </span><span class="COMM">// Coerce arguments to an array.</span><span class="WHIT">
+<span class='line'> 12</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nowUtil.clone</span><span class="PUNC">(</span><span class="NAME">Array.prototype</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 13</span> </span><span class="WHIT"> </span><span class="COMM">// Find functions in the args, and store functions in</span><span class="WHIT">
+<span class='line'> 14</span> </span><span class="WHIT"> </span><span class="COMM">// closure table and serialize functions.</span><span class="WHIT">
+<span class='line'> 15</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">closureId</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 16</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ii</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">args.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">ii</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 17</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 18</span> </span><span class="WHIT"> </span><span class="NAME">closureId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'closure_'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'_'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">nowUtil.generateRandomString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="NAME">nowjs.closures</span><span class="PUNC">[</span><span class="NAME">closureId</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">fqn</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">closureId</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 22</span> </span><span class="WHIT"> </span><span class="NAME">nowjs.closures</span><span class="PUNC">[</span><span class="NAME">closureId</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nowUtil.noop</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nowjs.options.closureTimeout</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 24</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="COMM">// On the next tick, send the remoteCall request</span><span class="WHIT">
+<span class='line'> 27</span> </span><span class="WHIT"> </span><span class="NAME">this.socket.emit</span><span class="PUNC">(</span><span class="STRN">'rfc'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">fqn</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.fqn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 28</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
+<span class='line'> 29</span> </span><span class="WHIT"> </span><span class="NAME">closurecall</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 30</span> </span><span class="WHIT"> </span><span class="COMM">// Coerce arguments to an array.</span><span class="WHIT">
+<span class='line'> 31</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 32</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ii</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">ii</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 33</span> </span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">arguments</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 34</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 35</span> </span><span class="WHIT"> </span><span class="COMM">// Find functions in the args, and store functions usin</span><span class="WHIT">
+<span class='line'> 36</span> </span><span class="WHIT"> </span><span class="COMM">// closure table and serialize functions.</span><span class="WHIT">
+<span class='line'> 37</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">closureId</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ii</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">args.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">ii</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'function'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="NAME">closureId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">'closure_'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">name</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'_'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">nowUtil.generateRandomString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="NAME">nowjs.closures</span><span class="PUNC">[</span><span class="NAME">closureId</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 42</span> </span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">fqn</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">closureId</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="NAME">setTimeout</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 44</span> </span><span class="WHIT"> </span><span class="NAME">nowjs.closures</span><span class="PUNC">[</span><span class="NAME">closureId</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nowUtil.noop</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">nowjs.options.closureTimeout</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 46</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 47</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 48</span> </span><span class="WHIT"> </span><span class="NAME">this.socket.write</span><span class="PUNC">(</span><span class="NAME">JSON.stringify</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">type</span><span class="PUNC">:</span><span class="STRN">'closurecall'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">fqn</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">this.fqn</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 49</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'> 50</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 51</span> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 52</span> </span></pre></body></html>
View
342 doc/jsdoc/symbols/src/now_lib_group.js.html
@@ -0,0 +1,342 @@
+<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
+ .KEYW {color: #933;}
+ .COMM {color: #bbb; font-style: italic;}
+ .NUMB {color: #393;}
+ .STRN {color: #393;}
+ .REGX {color: #339;}
+ .line {border-right: 1px dotted #666; color: #666; font-style: normal;}
+ </style></head><body><pre><span class='line'> 1</span> <span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">EventEmitter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">require</span><span class="PUNC">(</span><span class="STRN">'events'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">EventEmitter</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 2</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">nowUtil</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">require</span><span class="PUNC">(</span><span class="STRN">'./nowUtil'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">nowUtil</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 3</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">Proxy</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">require</span><span class="PUNC">(</span><span class="STRN">'./proxy'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 4</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ScopeTable</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">require</span><span class="PUNC">(</span><span class="STRN">'./scopeTable'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">ScopeTable</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 5</span>
+<span class='line'> 6</span> </span><span class="NAME">exports.initialize</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">nowjs</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 7</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">require</span><span class="PUNC">(</span><span class="STRN">'./function'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">init</span><span class="PUNC">(</span><span class="NAME">nowjs</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 8</span>
+<span class='line'> 9</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 10</span> * @name Group
+<span class='line'> 11</span>
+<span class='line'> 12</span> * @class Represents a group containing some subset of all
+<span class='line'> 13</span> users. Each group has its own {@link Group#now} namespace.
+<span class='line'> 14</span>
+<span class='line'> 15</span> * @property {String} groupName The name associated with the group.
+<span class='line'> 16</span> * @see nowjs#getGroup
+<span class='line'> 17</span> * @see Group#now
+<span class='line'> 18</span> */</span><span class="WHIT">
+<span class='line'> 19</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">Group</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">groupName</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 20</span> </span><span class="WHIT"> </span><span class="COMM">// all users in the group</span><span class="WHIT">
+<span class='line'> 21</span> </span><span class="WHIT"> </span><span class="NAME">this.users</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 22</span>
+<span class='line'> 23</span> </span><span class="WHIT"> </span><span class="NAME">this.groupName</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">groupName</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 24</span>
+<span class='line'> 25</span> </span><span class="WHIT"> </span><span class="NAME">this.excludes</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 26</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 27</span> * @name Group#now
+<span class='line'> 28</span> * @namespace The now namespace for this particular group. Actions
+<span class='line'> 29</span> * to this namespace affect all users that are members of the
+<span class='line'> 30</span> * group. All functions that are called will be called in the
+<span class='line'> 31</span> * context of each individual user in the group.
+<span class='line'> 32</span>
+<span class='line'> 33</span> * @example everyone.now.prop = 42;
+<span class='line'> 34</span> * @example everyone.now.func = function () {
+<span class='line'> 35</span> * console.log('hello!');
+<span class='line'> 36</span> * };
+<span class='line'> 37</span> */</span><span class="WHIT">
+<span class='line'> 38</span> </span><span class="WHIT"> </span><span class="NAME">this.now</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Proxy.wrap</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 39</span> </span><span class="WHIT"> </span><span class="COMM">// group scope table</span><span class="WHIT">
+<span class='line'> 40</span> </span><span class="WHIT"> </span><span class="NAME">this.scopeTable</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ScopeTable</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 41</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 42</span>
+<span class='line'> 43</span> </span><span class="WHIT"> </span><span class="NAME">Group.prototype.__proto__</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">EventEmitter.prototype</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 44</span>
+<span class='line'> 45</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 46</span> * @name count
+<span class='line'> 47</span> * @function
+<span class='line'> 48</span> * @memberOf Group#
+<span class='line'> 49</span>
+<span class='line'> 50</span> * @description Used to find the cardinality of the group (how
+<span class='line'> 51</span> * many users it contains).
+<span class='line'> 52</span>
+<span class='line'> 53</span> * @param {Function} callback Called with a Number corresponding to
+<span class='line'> 54</span> * the group's user count.
+<span class='line'> 55</span>
+<span class='line'> 56</span> * @example everyone.count(function (ct) {
+<span class='line'> 57</span> * console.log(ct);
+<span class='line'> 58</span> * });
+<span class='line'> 59</span> */</span><span class="WHIT">
+<span class='line'> 60</span> </span><span class="WHIT"> </span><span class="NAME">Group.prototype.count</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 61</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">Object.keys</span><span class="PUNC">(</span><span class="NAME">this.users</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">length</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 62</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 63</span>
+<span class='line'> 64</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 65</span> * @name getUsers
+<span class='line'> 66</span> * @function
+<span class='line'> 67</span> * @memberOf Group#
+<span class='line'> 68</span>
+<span class='line'> 69</span> * @description Used to retrieve a list of the client IDs
+<span class='line'> 70</span> * corresponding to all users in the group.
+<span class='line'> 71</span>
+<span class='line'> 72</span> * @param {Function} callback Called with an Array of Strings
+<span class='line'> 73</span> * corresponding to the client IDs of all users in the group.
+<span class='line'> 74</span>
+<span class='line'> 75</span> * @example everyone.getUsers(function (users) {
+<span class='line'> 76</span> * for (var i = 0; i &lt; users.length; i++) console.log(users[i]);
+<span class='line'> 77</span> * });
+<span class='line'> 78</span>
+<span class='line'> 79</span> * @see nowjs#getClient
+<span class='line'> 80</span> */</span><span class="WHIT">
+<span class='line'> 81</span> </span><span class="WHIT"> </span><span class="NAME">Group.prototype.getUsers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 82</span> </span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">Object.keys</span><span class="PUNC">(</span><span class="NAME">this.users</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 83</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 84</span>
+<span class='line'> 85</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 86</span> * @name connected
+<span class='line'> 87</span> * @function
+<span class='line'> 88</span> * @memberOf Group#
+<span class='line'> 89</span> * @deprecated As of 0.7.0. Use nowjs:connect instead.
+<span class='line'> 90</span> */</span><span class="WHIT">
+<span class='line'> 91</span> </span><span class="WHIT"> </span><span class="NAME">Group.prototype.connected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'> 92</span> </span><span class="WHIT"> </span><span class="NAME">nowjs.on</span><span class="PUNC">(</span><span class="STRN">'connect'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 93</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'> 94</span>
+<span class='line'> 95</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'> 96</span> * @name disconnected
+<span class='line'> 97</span> * @function
+<span class='line'> 98</span> * @memberOf Group#
+<span class='line'> 99</span> * @deprecated As of 0.7.0. Use nowjs:disconnect instead.
+<span class='line'>100</span> */</span><span class="WHIT">
+<span class='line'>101</span> </span><span class="WHIT"> </span><span class="NAME">Group.prototype.disconnected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>102</span> </span><span class="WHIT"> </span><span class="NAME">nowjs.on</span><span class="PUNC">(</span><span class="STRN">'disconnect'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>103</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>104</span>
+<span class='line'>105</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>106</span> * @name addUser
+<span class='line'>107</span> * @function
+<span class='line'>108</span> * @memberOf Group#
+<span class='line'>109</span> * @description Adds the user identified by clientId to this group.
+<span class='line'>110</span>
+<span class='line'>111</span> * @param {String} clientId The client ID associated with the target
+<span class='line'>112</span> * user.
+<span class='line'>113</span>
+<span class='line'>114</span> * @example everyone.addUser('1234567890');
+<span class='line'>115</span> */</span><span class="WHIT">
+<span class='line'>116</span> </span><span class="WHIT"> </span><span class="NAME">Group.prototype.addUser</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">clientId</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>117</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>118</span> </span><span class="WHIT"> </span><span class="NAME">this.hasClient</span><span class="PUNC">(</span><span class="NAME">clientId</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hasClient</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>119</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hasClient</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>120</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>121</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>122</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">self.excludes</span><span class="PUNC">[</span><span class="NAME">clientId</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>123</span> </span><span class="WHIT"> </span><span class="NAME">self.excludes</span><span class="PUNC">[</span><span class="NAME">clientId</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>124</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>125</span> </span><span class="WHIT"> </span><span class="NAME">nowjs.getClient</span><span class="PUNC">(</span><span class="NAME">clientId</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>126</span> </span><span class="WHIT"> </span><span class="COMM">// Scoping note: `self` refers to the group, `this` refers to</span><span class="WHIT">
+<span class='line'>127</span> </span><span class="WHIT"> </span><span class="COMM">// the new client.</span><span class="WHIT">
+<span class='line'>128</span> </span><span class="WHIT"> </span><span class="NAME">self.users</span><span class="PUNC">[</span><span class="NAME">this.user.clientId</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>129</span> </span><span class="WHIT"> </span><span class="NAME">this.groups</span><span class="PUNC">[</span><span class="NAME">self.groupName</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>130</span>
+<span class='line'>131</span> </span><span class="WHIT"> </span><span class="COMM">// Send the client any new variables that it does not already have</span><span class="WHIT">
+<span class='line'>132</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">toSend</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>133</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Object.keys</span><span class="PUNC">(</span><span class="NAME">self.scopeTable.data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>134</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>135</span> </span><span class="WHIT"> </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ll</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keys.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">ll</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">++</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>136</span> </span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">keys</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>137</span> </span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.scopeTable.get</span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>138</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">nowUtil.noop</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">Array.isArray</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
+<span class='line'>139</span> </span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">nowUtil.hasProperty</span><span class="PUNC">(</span><span class="NAME">this.scopeTable.data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>140</span> </span><span class="WHIT"> </span><span class="NAME">toSend</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nowUtil.getValOrFqn</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>141</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>142</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>143</span>
+<span class='line'>144</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">self.isSuperGroup</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">nowUtil.isEmptyObj</span><span class="PUNC">(</span><span class="NAME">toSend</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>145</span> </span><span class="WHIT"> </span><span class="NAME">this.socket.emit</span><span class="PUNC">(</span><span class="STRN">'rv'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">toSend</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>146</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>147</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">user</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">nowUtil.clone</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="STRN">'_events'</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">self._events</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>148</span>
+<span class='line'>149</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>150</span> * @name Group#join
+<span class='line'>151</span> * @event
+<span class='line'>152</span> * @description Called in the context of a user who has just been
+<span class='line'>153</span> * added to the group.
+<span class='line'>154</span>
+<span class='line'>155</span> * @example everyone.on('join', function () {
+<span class='line'>156</span> * otherGroup.addUser(this.user.clientId);
+<span class='line'>157</span> * });
+<span class='line'>158</span> */</span><span class="WHIT">
+<span class='line'>159</span> </span><span class="WHIT"> </span><span class="NAME">self.emit.call</span><span class="PUNC">(</span><span class="NAME">user</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">'join'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>160</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>161</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>162</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>163</span>
+<span class='line'>164</span> </span><span class="WHIT"> </span><span class="COMM">/**
+<span class='line'>165</span> * @name removeUser
+<span class='line'>166</span> * @function
+<span class='line'>167</span> * @memberOf Group#
+<span class='line'>168</span> * @version 0.7.0
+<span class='line'>169</span> * @description Removes the user identified by clientId from this group.
+<span class='line'>170</span>
+<span class='line'>171</span> * @param {String} clientId The client ID associated with the target
+<span class='line'>172</span> * user.
+<span class='line'>173</span>
+<span class='line'>174</span> * @example otherGroup.removeUser('1234567890');
+<span class='line'>175</span> */</span><span class="WHIT">
+<span class='line'>176</span> </span><span class="WHIT"> </span><span class="NAME">Group.prototype.removeUser</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">clientId</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>177</span> </span><span class="WHIT"> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>178</span> </span><span class="WHIT"> </span><span class="NAME">this.hasClient</span><span class="PUNC">(</span><span class="NAME">clientId</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">hasClient</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>179</span> </span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">hasClient</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
+<span class='line'>180</span> </span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
+<span class='line'>181</span> </span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
+<span class='line'>182</span> </span><span class="WHIT"> </span><span class="KEYW"