function executeSchedule(parentSubscription, scheduler, work, delay, repeat) {
    if (delay === undefined) { delay = 0; }
    if (repeat === undefined) { repeat = false; }
    var scheduleSubscription = scheduler.schedule(function () {
        work();
        if (repeat) {
            parentSubscription.add(this.schedule(null, delay));
        }
        else {
            this.unsubscribe();
        }
    }, delay);
    parentSubscription.add(scheduleSubscription);
    if (!repeat) {
        return scheduleSubscription;
    }
}

export { executeSchedule };
//# sourceMappingURL=executeSchedule.js.map
