executeSchedule.js 726 B

12345678910111213141516171819202122
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.executeSchedule = void 0;
  4. function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
  5. if (delay === void 0) { delay = 0; }
  6. if (repeat === void 0) { repeat = false; }
  7. var scheduleSubscription = scheduler.schedule(function () {
  8. work();
  9. if (repeat) {
  10. parentSubscription.add(this.schedule(null, delay));
  11. }
  12. else {
  13. this.unsubscribe();
  14. }
  15. }, delay);
  16. parentSubscription.add(scheduleSubscription);
  17. if (!repeat) {
  18. return scheduleSubscription;
  19. }
  20. }
  21. exports.executeSchedule = executeSchedule;
  22. //# sourceMappingURL=executeSchedule.js.map