A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://reactivex.io/documentation/operators/skip.html below:

ReactiveX - Skip operator

  1. Operators
  2. Filtering
  3. Skip
Skip suppress the first n items emitted by an Observable

You can ignore the first n items emitted by an Observable and attend only to those items that come after, by modifying the Observable with the Skip operator.

See Also Language-Specific Information:

In RxGroovy, this operator is implemented as skip.

Sample Code
numbers = Observable.from([1, 2, 3, 4, 5, 6, 7, 8]);

numbers.skip(3).subscribe(
  { println(it); },                          // onNext
  { println("Error: " + it.getMessage()); }, // onError
  { println("Sequence complete"); }          // onCompleted
);
4
5
6
7
8
Sequence complete

This variant of skip does not by default operate on any particular Scheduler.

There is also a variant of skip that takes a temporal duration rather than a quantity of items. It drops those items that are emitted during that initial duration of the source Observable’s lifespan. You set this duration by passing in a length of time and the time units this length is denominated in as parameters to skip.

This variant of skip by default operates on the computation Scheduler, but you may also pass in a Scheduler of your choosing as an optional third parameter.

In RxJava, this operator is implemented as skip.

This variant of skip does not by default operate on any particular Scheduler.

There is also a variant of skip that takes a temporal duration rather than a quantity of items. It drops those items that are emitted during that initial duration of the source Observable’s lifespan. You set this duration by passing in a length of time and the time units this length is denominated in as parameters to skip.

This variant of skip by default operates on the computation Scheduler, but you may also pass in a Scheduler of your choosing as an optional third parameter.

RxJS implements the skip operator.

Sample Code
var source = Rx.Observable.range(0, 5)
    .skip(3);

var subscription = source.subscribe(
    function (x) { console.log('Next: ' + x); },
    function (err) { console.log('Error: ' + err); },
    function () { console.log('Completed'); });
Next: 3
Next: 4
Completed

skip is found in each of the following distributions:

RxJS also implements a skipUntilWithTime operator that does not skip a particular quantity of items from the source Observable, but skips items based on chronology. You set this skip period by passing in a parameter to skipUntilWithTime, in either of these formats:

a number
skips items from the source Observable until this many milliseconds have passed since the Observable was subscribed to
a Date
skips items from the source Observable until this absolute time

You may also, optionally, pass in a Scheduler as a second parameter, and the timer will operate on that Scheduler (skipUntilWithTime uses the timeout Scheduler by default).

Sample Code
var source = Rx.Observable.timer(0, 1000)
    .skipUntilWithTime(5000);

var subscription = source.subscribe(
    function (x) { console.log('Next: ' + x); },
    function (err) { console.log('Error: ' + err); },
    function () { console.log('Completed'); });
Next: 6
Next: 7
Next: 8
Completed

skipUntilWithTime is found in each of the following distributions:

RxPHP implements this operator as skip.

Sample Code
//from https://github.com/ReactiveX/RxPHP/blob/master/demo/skip/skip.php

use Rx\Observable\ArrayObservable;

$observable = Rx\Observable::fromArray([1, 1, 2, 3, 5, 8, 13]);
$observable
    ->skip(3)
    ->subscribe($stdoutObserver);

   
Next value: 3
Next value: 5
Next value: 8
Next value: 13
Complete!
    

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4