vscroll
Version:
Virtual scroll engine
76 lines • 2.36 kB
JavaScript
import { Reactive } from '../reactive';
var InnerLoopModel = /** @class */ (function () {
function InnerLoopModel(total) {
this.total = total;
this.isInitial = false;
this.busy = new Reactive(false);
}
Object.defineProperty(InnerLoopModel.prototype, "first", {
get: function () {
return this.count === 0;
},
enumerable: false,
configurable: true
});
InnerLoopModel.prototype.done = function () {
this.isInitial = false;
this.count++;
this.total++;
this.busy.set(false);
};
InnerLoopModel.prototype.start = function () {
this.busy.set(true);
};
InnerLoopModel.prototype.dispose = function () {
this.busy.dispose();
};
return InnerLoopModel;
}());
var WorkflowCycleModel = /** @class */ (function () {
function WorkflowCycleModel(instanceIndex, cycle) {
var cycleCount = cycle ? cycle.count : 1;
var loopCount = cycle ? cycle.innerLoop.count : 0;
this.instanceIndex = instanceIndex;
this.innerLoop = new InnerLoopModel(loopCount);
this.interrupter = null;
this.busy = new Reactive(false);
this.end(cycleCount);
}
Object.defineProperty(WorkflowCycleModel.prototype, "loopId", {
get: function () {
return "".concat(this.instanceIndex, "-").concat(this.count, "-").concat(this.innerLoop.total);
},
enumerable: false,
configurable: true
});
Object.defineProperty(WorkflowCycleModel.prototype, "loopIdNext", {
get: function () {
return "".concat(this.instanceIndex, "-").concat(this.count, "-").concat(this.innerLoop.total + 1);
},
enumerable: false,
configurable: true
});
WorkflowCycleModel.prototype.start = function (isInitial, initiator) {
this.isInitial = isInitial;
this.initiator = initiator;
this.innerLoop.isInitial = isInitial;
this.innerLoop.count = 0;
this.interrupter = null;
this.busy.set(true);
};
WorkflowCycleModel.prototype.end = function (count) {
this.count = count;
this.isInitial = false;
this.busy.set(false);
};
WorkflowCycleModel.prototype.dispose = function (forever) {
if (forever) {
// otherwise the value will be persisted during re-instantiation
this.busy.dispose();
}
this.innerLoop.dispose();
};
return WorkflowCycleModel;
}());
export { WorkflowCycleModel };
//# sourceMappingURL=cycle.js.map