Last change
on this file was
484,
checked in by hendrikvanantwerpen, 11 years ago
|
Commit node_modules, to make checkouts and builds more deterministic.
|
File size:
714 bytes
|
Rev | Line | |
---|
[484] | 1 | |
---|
| 2 | /** |
---|
| 3 | * Module dependencies. |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | var Runnable = require('./runnable'); |
---|
| 7 | |
---|
| 8 | /** |
---|
| 9 | * Expose `Hook`. |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | module.exports = Hook; |
---|
| 13 | |
---|
| 14 | /** |
---|
| 15 | * Initialize a new `Hook` with the given `title` and callback `fn`. |
---|
| 16 | * |
---|
| 17 | * @param {String} title |
---|
| 18 | * @param {Function} fn |
---|
| 19 | * @api private |
---|
| 20 | */ |
---|
| 21 | |
---|
| 22 | function Hook(title, fn) { |
---|
| 23 | Runnable.call(this, title, fn); |
---|
| 24 | this.type = 'hook'; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | /** |
---|
| 28 | * Inherit from `Runnable.prototype`. |
---|
| 29 | */ |
---|
| 30 | |
---|
| 31 | Hook.prototype.__proto__ = Runnable.prototype; |
---|
| 32 | |
---|
| 33 | /** |
---|
| 34 | * Get or set the test `err`. |
---|
| 35 | * |
---|
| 36 | * @param {Error} err |
---|
| 37 | * @return {Error} |
---|
| 38 | * @api public |
---|
| 39 | */ |
---|
| 40 | |
---|
| 41 | Hook.prototype.error = function(err){ |
---|
| 42 | if (0 == arguments.length) { |
---|
| 43 | var err = this._error; |
---|
| 44 | this._error = null; |
---|
| 45 | return err; |
---|
| 46 | } |
---|
| 47 | |
---|
| 48 | this._error = err; |
---|
| 49 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.