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

Function tick

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

Source from the content-addressed store, hash-verified

510 * @since 2.0.0
511 */
512export const tick = (interval: Duration.Input): Stream<void> =>
513 fromPull(Effect.sync(() => {
514 let first = true
515 const effect = Effect.succeed(Arr.of<void>(undefined))
516 const delayed = Effect.delay(effect, interval)
517 return Effect.suspend(() => {
518 if (first) {
519 first = false
520 return effect
521 }
522 return delayed
523 })
524 }))
525
526/**
527 * 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