( delay: Duration.DurationInput, ...delays: Array<Duration.DurationInput> )
| 799 | |
| 800 | /** @internal */ |
| 801 | export const fromDelays = ( |
| 802 | delay: Duration.DurationInput, |
| 803 | ...delays: Array<Duration.DurationInput> |
| 804 | ): Schedule.Schedule<Duration.Duration> => |
| 805 | makeWithState( |
| 806 | [[delay, ...delays].map((_) => Duration.decode(_)) as Array<Duration.Duration>, true as boolean] as const, |
| 807 | (now, _, [durations, cont]) => |
| 808 | core.sync(() => { |
| 809 | if (cont) { |
| 810 | const x = durations[0]! |
| 811 | const interval = Interval.after(now + Duration.toMillis(x)) |
| 812 | if (durations.length >= 2) { |
| 813 | return [ |
| 814 | [durations.slice(1), true] as const, |
| 815 | x, |
| 816 | ScheduleDecision.continueWith(interval) |
| 817 | ] as const |
| 818 | } |
| 819 | const y = durations.slice(1) |
| 820 | return [ |
| 821 | [[x, ...y] as Array<Duration.Duration>, false] as const, |
| 822 | x, |
| 823 | ScheduleDecision.continueWith(interval) |
| 824 | ] as const |
| 825 | } |
| 826 | return [[durations, false] as const, Duration.zero, ScheduleDecision.done] as const |
| 827 | }) |
| 828 | ) |
| 829 | |
| 830 | /** @internal */ |
| 831 | export const fromFunction = <A, B>(f: (a: A) => B): Schedule.Schedule<B, A> => map(identity<A>(), f) |
nothing calls this directly
no test coverage detected