Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Document Worker.

  • Loading branch information...
commit 60dc08260d0b96becc7db8588b71efa12e89f47e 1 parent c7843b9
@jaredhanson authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 lib/functionpool/worker.js
View
21 lib/functionpool/worker.js
@@ -1,14 +1,32 @@
+/**
+ * Module dependencies.
+ */
var util = require('util')
, EventEmitter = require('events').EventEmitter;
+/**
+ * `Worker` constructor.
+ *
+ * @param {Function} fn
+ * @api private
+ */
function Worker(fn) {
EventEmitter.call(this);
this.busy = false;
this._fn = fn;
};
+/**
+ * Inherit from `EventEmitter`.
+ */
util.inherits(Worker, EventEmitter);
+/**
+ * Instruct a worker to execute task with `args`.
+ *
+ * @param {Array} args
+ * @api private
+ */
Worker.prototype.work = function(args) {
args = args || [];
@@ -28,4 +46,7 @@ Worker.prototype.work = function(args) {
};
+/**
+ * Expose `Worker`.
+ */
module.exports = Worker;
Please sign in to comment.
Something went wrong with that request. Please try again.