This repository was archived by the owner on Oct 1, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +43
-2
lines changed
src/operator-docs/filtering Expand file tree Collapse file tree 1 file changed +43
-2
lines changed Original file line number Diff line number Diff line change 11import { OperatorDoc } from '../operator.model' ;
22
33export const last : OperatorDoc = {
4- 'name' : 'last' ,
5- 'operatorType' : 'filtering'
4+ name : 'last' ,
5+ operatorType : 'filtering' ,
6+ signature : 'public last(predicate: function): Observable' ,
7+ useInteractiveMarbles : true ,
8+ parameters : [
9+ {
10+ name : 'predicate' ,
11+ type : 'function' ,
12+ attribute : '' ,
13+ description : 'The condition any source emitted item has to satisfy.'
14+ }
15+ ] ,
16+ marbleUrl : 'http://reactivex.io/rxjs/img/last.png' ,
17+ shortDescription : {
18+ description : `Emits only the last value emitted by the source Observable.`
19+ } ,
20+ walkthrough : {
21+ description : `<p>
22+ <span class="markdown-code">last</span> Returns an Observable that emits only the last item emitted by the source Observable.
23+ </p>
24+ <p>
25+ It optionally takes a predicate function as a parameter,
26+ in which case, rather than emitting the last item from the source Observable,
27+ the resulting Observable will emit the last item from the source Observable that satisfies the predicate.
28+ </p>`
29+ } ,
30+ examples : [
31+ {
32+ name : 'Get the last number that is divisible by 3' ,
33+ code : `
34+ const range = Rx.Observable.range(1, 10);
35+ const last = range.last(x => x % 3 === 0);
36+ last.subscribe(x => console.log(x));
37+ // Logs below values
38+ // 9
39+ ` ,
40+ externalLink : {
41+ platform : 'JSBin' ,
42+ url : 'http://jsbin.com/reqacoselu/embed?html,js,console'
43+ }
44+ }
45+ ] ,
46+ relatedOperators : [ 'takeLast' , 'first' ]
647} ;
You can’t perform that action at this time.
0 commit comments