|
1 | 1 | import { OperatorDoc } from '../operator.model';
|
2 | 2 |
|
3 | 3 | export const letOperator: OperatorDoc = {
|
4 |
| - 'name': 'let', |
5 |
| - 'operatorType': 'utility' |
| 4 | + name: 'let', |
| 5 | + operatorType: 'utility', |
| 6 | + signature: 'public let(fun: function): Observable,', |
| 7 | + parameters: [ |
| 8 | + { |
| 9 | + name: 'fun', |
| 10 | + type: 'function', |
| 11 | + attribute: '', |
| 12 | + description: `Selector function which can use the source sequence |
| 13 | + as many times as needed, without sharing subscriptions to the source sequence.` |
| 14 | + } |
| 15 | + ], |
| 16 | + shortDescription: { |
| 17 | + description: `Returns an observable sequence that is the result of invoking the selector on the source sequence, |
| 18 | + without sharing subscriptions. This operator allows for a fluent style of writing queries that use the same |
| 19 | + sequence multiple times. There is an alias of letBind for browsers older than IE 9.` |
| 20 | + }, |
| 21 | + additionalResources: [ |
| 22 | + { |
| 23 | + url: 'https://www.learnrxjs.io/operators/utility/let.html', |
| 24 | + description: 'several examples of using the let operator', |
| 25 | + author: 'btroncone' |
| 26 | + } |
| 27 | + ], |
| 28 | + examples: [ |
| 29 | + { |
| 30 | + name: 'calls concat as part of a pipeline', |
| 31 | + code: ` |
| 32 | + import { range } from 'rxjs/observable/range'; |
| 33 | +
|
| 34 | + const obs = range(1, 3); |
| 35 | +
|
| 36 | + const source = obs.let((o) => o.concat(o)); |
| 37 | +
|
| 38 | + const subscription = source.subscribe( |
| 39 | + (x) => { |
| 40 | + console.log('Next: ' + x); |
| 41 | + }, |
| 42 | + (err) => { |
| 43 | + console.log('Error: ' + err); |
| 44 | + }, |
| 45 | + () => { |
| 46 | + console.log('Completed'); |
| 47 | + }); |
| 48 | +
|
| 49 | + // => Next: 1 |
| 50 | + // => Next: 2 |
| 51 | + // => Next: 3 |
| 52 | + // => Next: 1 |
| 53 | + // => Next: 2 |
| 54 | + // => Next: 3 |
| 55 | + // => Completed |
| 56 | + `, |
| 57 | + externalLink: { |
| 58 | + platform: 'JSBin', |
| 59 | + url: 'http://jsbin.com/giwanupiqu/embed?html,js,console' |
| 60 | + } |
| 61 | + } |
| 62 | + ] |
6 | 63 | };
|
0 commit comments