Skip to content
richardszalay edited this page Sep 14, 2010 · 8 revisions

Takes only the last set number of values from a source sequence

function takeLast(count : uint)

Remarks

The returned sequence completes when the source sequence completes.

The returned sequence errors when the source sequences errors

Marble Diagrams

xs  ──o──o──o──o──/
      0  1  2  3  │
                  │
ys  ──────────────o─o─o─/
                  1 2 3

Return Value

IObservable.<sourceType>

Examples

Observable.range(0, 5)
    .takeLast(3)
    .subscribeFunc(function(value : int) : void
    {
        trace(value);
    });

    // Trace output is:
    // 2
    // 3
    // 4
Clone this wiki locally