( delay: Duration.DurationInput, ...delays: Array<Duration.DurationInput> )
| 791 | |
| 792 | /** @internal */ |
| 793 | export const fromDelays = ( |
| 794 | delay: Duration.DurationInput, |
| 795 | ...delays: Array<Duration.DurationInput> |
| 796 | ): Schedule.Schedule<Duration.Duration> => |
| 797 | makeWithState( |
| 798 | [[delay, ...delays].map((_) => Duration.decode(_)) as Array<Duration.Duration>, true as boolean] as const, |
| 799 | (now, _, [durations, cont]) => |
| 800 | core.sync(() => { |
| 801 | if (cont) { |
| 802 | const x = durations[0]! |
| 803 | const interval = Interval.after(now + Duration.toMillis(x)) |
| 804 | if (durations.length >= 2) { |
| 805 | return [ |
| 806 | [durations.slice(1), true] as const, |
| 807 | x, |
| 808 | ScheduleDecision.continueWith(interval) |
| 809 | ] as const |
| 810 | } |
| 811 | const y = durations.slice(1) |
| 812 | return [ |
| 813 | [[x, ...y] as Array<Duration.Duration>, false] as const, |
| 814 | x, |
| 815 | ScheduleDecision.continueWith(interval) |
| 816 | ] as const |
| 817 | } |
| 818 | return [[durations, false] as const, Duration.zero, ScheduleDecision.done] as const |
| 819 | }) |
| 820 | ) |
| 821 | |
| 822 | /** @internal */ |
| 823 | 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
searching dependent graphs…