您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

SyncLoopHook.js 800B

12345678910111213141516171819202122232425262728293031323334353637
  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 SyncLoopHookCodeFactory extends HookCodeFactory {
  9. content({ onError, onDone, rethrowIfPossible }) {
  10. return this.callTapsLooping({
  11. onError: (i, err) => onError(err),
  12. onDone,
  13. rethrowIfPossible
  14. });
  15. }
  16. }
  17. const factory = new SyncLoopHookCodeFactory();
  18. class SyncLoopHook extends Hook {
  19. tapAsync() {
  20. throw new Error("tapAsync is not supported on a SyncLoopHook");
  21. }
  22. tapPromise() {
  23. throw new Error("tapPromise is not supported on a SyncLoopHook");
  24. }
  25. compile(options) {
  26. factory.setup(this, options);
  27. return factory.create(options);
  28. }
  29. }
  30. module.exports = SyncLoopHook;