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:20

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.

Note: because this is timer(0, …), the first value (0) is emitted immediately rather than after one period — unlike RxJS interval, whose first tick arrives after intervalMs.

Parameters ​

intervalMs ​

number

The time in milliseconds between each emission.

Returns ​

Atom<number>

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

Released under the MIT License.