Permalink
Browse files

Add man page, AUTHORS file

  • Loading branch information...
Félix Saparelli
Félix Saparelli committed Nov 5, 2011
1 parent 1acdecc commit ce4eb616ea9f9418a68ae0726c3cbb0ae552712d
Showing with 214 additions and 1 deletion.
  1. +1 −1 .gitignore
  2. +2 −0 AUTHORS
  3. +75 −0 dynworker.js
  4. +136 −0 man/dynworker.7
View
@@ -1 +1 @@
-dynworker.js
+
View
@@ -0,0 +1,2 @@
+Félix Saparelli <me@passcod.net> (http://passcod.net)
+
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -0,0 +1,136 @@
+.TH DynWorker 7 "5 Nov 2011"
+
+.SH NAME
+
+DynWorker - Web threading made easy
+
+
+.SH DESCRIPTION
+
+A tiny library to ease web threading. Now you can have you logic anywhere you want it,
+not necessarily inside the worker script. You can inject functions into the worker, run
+code inside there, and there's a few methods to handle passing messages painlessly.
+
+.PP
+If you use Ender (http://ender.no.de) - you should - DynWorker is available on the
+.B $.worker
+namespace. Otherwise, it is the
+.B DynWorker
+global.
+
+
+.SH SYNOPSIS
+
+If the library is in the current dir and is named
+.I dynworker.js
+, this works:
+
+.B var worker = new DynWorker();
+
+.PP
+Otherwise you need to specify a filename, but it needs to be on the same domain.
+
+.B var worker = new DynWorker("/js/lib/dynworker.min.js");
+
+.PP
+You can also modify the default path once and for all:
+
+.B DynWorker.path("path/to/dynworker.js");
+.sp 0.5
+.B var worker = new DynWorker();
+
+.PP
+The function is namespaced under
+.I DynWorker.ns
+inside the worker.
+
+.B worker.inject("funcName", function(arg1, arg2) {
+.sp 0.5
+.B " "
+.B " "
+.B var result = "Do something awesome here";
+.sp 0.5
+.B " "
+.B " "
+.B DynWorker.ns.funcName('foo', 'bar');
+// Recursion
+.sp 0.5
+.B " "
+.B " "
+.B return result;
+.sp 0.5
+.B });
+
+.PP
+The callback gets back the raw event
+
+.B worker.receive(function(e) {
+.sp 0.5
+.B " "
+.B " "
+.B e.data;
+// Display and strike awe
+.sp 0.5
+.B });
+
+.PP
+The
+.I worker.run()
+function wraps the function call in a
+.I DynWorker.send()
+so the return value of the function is sent up.
+
+.B worker.run("funcName", arg1, arg2);
+
+.PP
+Hence, these two are equivalent:
+
+.B worker.run("funcName");
+.sp 0.5
+.B worker.eval("DynWorker.send(DynWorker.ns['funcName']());");
+
+
+.SH FILES
+
+.I ender/
+.RS
+Used by Ender
+.RE
+
+.I dynworker.coffee
+.RS
+The source of the script
+.RE
+
+.I dynworker.js
+.RS
+The coffee-compiled script. It should be available at
+.sp 0.5
+.I ./dynworker.js
+or wherever you specify it to be using the
+.sp 0.5
+.I DynWorker.path()
+function.
+.RE
+
+
+.SH BUGS
+
+Use the GitHub issue tracker at
+.sp 0.5
+.I https://github.com/passcod/DynWorker/issues
+.sp 0.5
+or send mail to
+.B me@passcod.net
+with a clear subject line.
+
+
+.SH AUTHORS
+
+DynWorker was written by Félix Saparelli. Contributors are listed in the
+.I AUTHORS
+file.
+
+.PP
+DynWorker is under the MIT License, the full text of which can be found at
+.I http://mit.passcod.net

0 comments on commit ce4eb61

Please sign in to comment.