Permalink
Browse files

Set options object during reset.

  • Loading branch information...
1 parent f6e008e commit f4b3ba83cdce0a1390497298e19519d39d5b7d8a @ritch ritch committed Apr 26, 2013
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/task.js
View
4 lib/task.js
@@ -23,8 +23,11 @@ var EventEmitter = require('events').EventEmitter
*/
function Task(options) {
+ options = options || {};
+
EventEmitter.apply(this, arguments);
+ assert(options, 'Task requires an options object');
assert(typeof options === 'object', 'Task requires an options object');
assert(typeof options.name === 'string', 'Task requires a name');
assert(typeof options.fn === 'function', 'Task requires a function');
@@ -128,5 +131,6 @@ Task.prototype.cleanup = function () {
delete this.options.fn;
delete this.options.scope;
delete this.options;
+ this.options = {};
}
}

0 comments on commit f4b3ba8

Please sign in to comment.