Skip to content

@epikodelabs/streamix


@epikodelabs/streamix / src/public-api / interval

Function: interval()

interval(intervalMs): Atom<number>

Defined in: projects/libraries/streamix/src/lib/factories/interval.ts:17

Creates an atom that emits incremental numbers starting from 0 at a regular interval.

This operator is a shorthand for timer(0, intervalMs), useful for creating a simple, repeating sequence of numbers. The atom emits a new value every intervalMs milliseconds. It is analogous to setInterval but as an asynchronous atom.

Parameters

intervalMs

MaybePromise<number>

The time in milliseconds between each emission.

Returns

Atom<number>

An atom that emits incrementing numbers (0, 1, 2, ...).

Released under the GNU AGPL v3 or later.