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

Buffers all the values from the sequence and emits them as an array when the sequence completes.

function toArray() : IObservable.<Array>

Remarks

The returned sequence completes when the source sequence completes

The returned sequence raises an error if the source sequence raises an error error.

Marble Diagrams

    0  1  3  4
xs ─o──o──o──o──/
                |
ys ─────────────o/
           [0,1,2,3,4]

Return Value

IObservable.<Array>

Examples

Observable.range(0, 10)
    .toArray()
    .subscribe(
        function(values : Array) : void
        {
            trace(values.join(", "));
        });

    // Trace output is:
    // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Clone this wiki locally