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.

32 lines
756 B

4 years ago
  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;