Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | "use strict"; exports.__esModule = true; var log_1 = require("./log"); var Store = /** @class */ (function () { function Store() { var _this = this; this.queue = new Set(); this.stack = 0; this.useDebug = false; this.currentObservers = []; this.readyToRun = false; this.runQueue = function () { _this.readyToRun = false; if (_this.queue.size === 0) return; _this.queue.forEach(function (observer) { return observer.run(); }); _this.queue.clear(); }; } Store.prototype.onError = function (error) { throw error; }; Store.prototype.useLog = function () { var _this = this; var unLog = log_1["default"](); this.unLog = function () { unLog(); _this.unLog = undefined; }; return this.unLog; }; Object.defineProperty(Store.prototype, "currentObserver", { get: function () { if (this.currentObservers.length === 0) return null; return this.currentObservers[this.currentObservers.length - 1]; }, enumerable: true, configurable: true }); Store.prototype.pushQueue = function (observers) { var _this = this; observers.forEach(function (observer) { return _this.queue.add(observer); }); if (!this.inAction && !this.readyToRun) { Promise.resolve().then(this.runQueue); this.readyToRun = true; } }; Object.defineProperty(Store.prototype, "inAction", { get: function () { return this.stack > 0; }, enumerable: true, configurable: true }); return Store; }()); exports.Store = Store; var store = new Store(); exports["default"] = store; |