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

Repeats a value a specified number of times

static function repeatValue(value : Object, repeatCount : uint = 0, 
    scheduler : IScheduler = null) : IObservable.<*>

Where repeatCount is the number of times to repeat (after the initial subscription), or 0 to repeat indefinitely.

Remarks

When the source sequence completes, it will be resubscribed to.

If the source sequence errors, the sequence will error and the source sequence will not be resubscribed to.

The returned sequence completes when the source sequence has been re-subscribed to repeatCount number of times and completed. If repeatCount is 0, the returned sequence never completes.

The returned sequence errors if the source sequence errors.

Marble Diagrams

xs    ──o─/
        │ └──o─/
        │    │ └──o─/ 
        │    │    │ │
ys    ──o────o────o─/

Scheduling

Unless specification, Scheduler.synchronous will be used to schedule repeats

Return Value

IObservable.<*>

Examples

Observable.repeatValue("raix", 1)
    .subscribe(
        function(x : String) : void { trace(x); },
        function():void { trace("Completed"); }
    );

    // Trace output is:
    // raix
    // raix
    // Completed
Clone this wiki locally