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

Delays values from the source by a specified amount of time.

function delay(delayMs : uint) : IObservable.<T>

Remarks

Each value emitted by the source will emitted after delayMs milliseconds.

The returned sequence completes when the source sequence completes.

The returned sequence errors when the source sequences errors.

Marble Diagrams

xs = source
ys = output

xs  ──o─────o─────o─────/
      │     └───┐ └───┐ └───┐
      │ delayMs │     │     │
      └────────┐└────┐└────┐└────┐
               │     │     │     │
ys  ───────────o─────o─────o─────/

Return Value

IObservable.<T>

Examples

var source : IObservable = Observable.range(0, 5)
    .delay(1000);

source.subscribe(function(value : int) : void
    {
        trace(value);
    });

// Trace output is:
// 0 (@ 00:00:01)
// 1 (@ 00:00:02)
// 2 (@ 00:00:03)
// 3 (@ 00:00:04)
// 4 (@ 00:00:05)
Clone this wiki locally