fromArrayScheduled
Signature - source.ts#L693
function fromArrayScheduled<T>(
array: ArrayLike<T>,
schedule: ScheduleFunction,
): Source<T>
Creates a source which will emit the items in the given array according to the given schedule function. For example, if the schedule function acts as a 1s interval then the items will be emitted on a 1s interval.
Parameters
Parameter | Type | Description |
---|---|---|
array |
| The array of items to schedule. |
schedule |
| The schedule function. |
Returns
Type | Description |
---|---|
| The created source. |
Example Usage
import {
fromArrayScheduled,
ScheduleInterval,
pipe,
subscribe
} from '@microstream/core';
const scheduleFunction = ScheduleInterval(1000);
pipe(
fromArrayScheduled([2, 4, 6], scheduleFunction),
subscribe(console.log)
)
// 1s -> Push(2)
// 2s -> Push(4)
// 3s -> Push(6), End