Dieses Repository beinhaltet HTML- und Javascript Code zur einer NotizenWebApp auf Basis von Web Storage. Zudem sind Mocha/Chai Tests im Browser enthalten. https://meinenotizen.netlify.app/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hook.js 881B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. 'use strict';
  2. var Runnable = require('./runnable');
  3. var inherits = require('./utils').inherits;
  4. /**
  5. * Expose `Hook`.
  6. */
  7. module.exports = Hook;
  8. /**
  9. * Initialize a new `Hook` with the given `title` and callback `fn`
  10. *
  11. * @class
  12. * @extends Runnable
  13. * @param {String} title
  14. * @param {Function} fn
  15. */
  16. function Hook(title, fn) {
  17. Runnable.call(this, title, fn);
  18. this.type = 'hook';
  19. }
  20. /**
  21. * Inherit from `Runnable.prototype`.
  22. */
  23. inherits(Hook, Runnable);
  24. /**
  25. * Resets the state for a next run.
  26. */
  27. Hook.prototype.reset = function() {
  28. Runnable.prototype.reset.call(this);
  29. delete this._error;
  30. };
  31. /**
  32. * Get or set the test `err`.
  33. *
  34. * @memberof Hook
  35. * @public
  36. * @param {Error} err
  37. * @return {Error}
  38. */
  39. Hook.prototype.error = function(err) {
  40. if (!arguments.length) {
  41. err = this._error;
  42. this._error = null;
  43. return err;
  44. }
  45. this._error = err;
  46. };