TestWatcher.js 1017 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. function _events() {
  7. const data = require('events');
  8. _events = function () {
  9. return data;
  10. };
  11. return data;
  12. }
  13. function _defineProperty(obj, key, value) {
  14. if (key in obj) {
  15. Object.defineProperty(obj, key, {
  16. value: value,
  17. enumerable: true,
  18. configurable: true,
  19. writable: true
  20. });
  21. } else {
  22. obj[key] = value;
  23. }
  24. return obj;
  25. }
  26. class TestWatcher extends _events().EventEmitter {
  27. constructor({isWatchMode}) {
  28. super();
  29. _defineProperty(this, 'state', void 0);
  30. _defineProperty(this, '_isWatchMode', void 0);
  31. this.state = {
  32. interrupted: false
  33. };
  34. this._isWatchMode = isWatchMode;
  35. }
  36. setState(state) {
  37. Object.assign(this.state, state);
  38. this.emit('change', this.state);
  39. }
  40. isInterrupted() {
  41. return this.state.interrupted;
  42. }
  43. isWatchMode() {
  44. return this._isWatchMode;
  45. }
  46. }
  47. exports.default = TestWatcher;