MCPcopy Create free account
hub / github.com/Effect-TS/effect / tick

Function tick

packages/effect/src/Stream.ts:558–570  ·  view source on GitHub ↗
(interval: Duration.Input)

Source from the content-addressed store, hash-verified

556 * @since 2.0.0
557 */
558export const tick = (interval: Duration.Input): Stream<void> =>
559 fromPull(Effect.sync(() => {
560 let first = true
561 const effect = Effect.succeed(Arr.of<void>(undefined))
562 const delayed = Effect.delay(effect, interval)
563 return Effect.suspend(() => {
564 if (first) {
565 first = false
566 return effect
567 }
568 return delayed
569 })
570 }))
571
572/**
573 * Creates a stream from a pull effect, such as one produced by `Stream.toPull`.

Callers

nothing calls this directly

Calls 4

fromPullFunction · 0.70
ofMethod · 0.65
syncMethod · 0.45
succeedMethod · 0.45

Tested by

no test coverage detected