Skip to content
richardszalay edited this page May 20, 2011 · 12 revisions

Creates an unending observable sequence of integers that are incremented at intervalMs (in milliseconds).

static function interval(intervalMs : uint, scheduler : IScheduler = null)

Remarks

The returned sequence does not complete

The returned sequence does not error

Marble Diagrams

│intervalMs│intervalMs│intervalMs│
───────────o──────────o──────────o──────────o──>
           0          1          2   ...    ∞

Scheduling

Unless specified, this operator uses Scheduler.synchronous.

Return Value

IObservable.<int>

Examples

Observable.interval(1000)
    .subscribe(function(index : int) : void
    {
        trace("1 second has elapsed (" (index+1).toString() + " total)");
    });

    // Trace output is:
    // 1 second has elapsed (1 total)
    // 1 second has elapsed (2 total)
    // 1 second has elapsed (3 total)
    // 1 second has elapsed (4 total)
    // ...