AsyncSeriesHook.js 756 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const Hook = require("./Hook");
  7. const HookCodeFactory = require("./HookCodeFactory");
  8. class AsyncSeriesHookCodeFactory extends HookCodeFactory {
  9. content({ onError, onDone }) {
  10. return this.callTapsSeries({
  11. onError: (i, err, next, doneBreak) => onError(err) + doneBreak(true),
  12. onDone
  13. });
  14. }
  15. }
  16. const factory = new AsyncSeriesHookCodeFactory();
  17. class AsyncSeriesHook extends Hook {
  18. compile(options) {
  19. factory.setup(this, options);
  20. return factory.create(options);
  21. }
  22. }
  23. Object.defineProperties(AsyncSeriesHook.prototype, {
  24. _call: { value: undefined, configurable: true, writable: true }
  25. });
  26. module.exports = AsyncSeriesHook;