Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

39 linhas
714 B

  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const asyncLib = require("neo-async");
  7. class MultiWatching {
  8. constructor(watchings, compiler) {
  9. this.watchings = watchings;
  10. this.compiler = compiler;
  11. }
  12. invalidate() {
  13. for (const watching of this.watchings) {
  14. watching.invalidate();
  15. }
  16. }
  17. close(callback) {
  18. asyncLib.forEach(
  19. this.watchings,
  20. (watching, finishedCallback) => {
  21. watching.close(finishedCallback);
  22. },
  23. err => {
  24. this.compiler.hooks.watchClose.call();
  25. if (typeof callback === "function") {
  26. this.compiler.running = false;
  27. callback(err);
  28. }
  29. }
  30. );
  31. }
  32. }
  33. module.exports = MultiWatching;