|
1 | 1 | import { OperatorDoc } from '../operator.model'; |
2 | 2 |
|
3 | 3 | export const delay: OperatorDoc = { |
4 | | - 'name': 'delay', |
5 | | - 'operatorType': 'utility' |
| 4 | + name: 'delay', |
| 5 | + operatorType: 'utility', |
| 6 | + signature: |
| 7 | + 'public delay(delay: number | Date, scheduler: Scheduler): Observable', |
| 8 | + parameters: [ |
| 9 | + { |
| 10 | + name: 'delay', |
| 11 | + type: 'number | Date', |
| 12 | + attribute: '', |
| 13 | + description: `The delay duration in milliseconds (a number) or a Date until which the |
| 14 | + emission of the source items is delayed.` |
| 15 | + }, |
| 16 | + { |
| 17 | + name: 'scheduer', |
| 18 | + type: 'Scheduler', |
| 19 | + attribute: '', |
| 20 | + description: |
| 21 | + 'The IScheduler to use for managing the timers that handle the time-shift for each item.' |
| 22 | + } |
| 23 | + ], |
| 24 | + useInteractiveMarbles: true, |
| 25 | + marbleUrl: 'http://reactivex.io/rxjs/img/delay.png', |
| 26 | + shortDescription: { |
| 27 | + description: ` |
| 28 | + Delays the emission of items from the source Observable by a given timeout or until a given Date. |
| 29 | + `, |
| 30 | + extras: [] |
| 31 | + }, |
| 32 | + walkthrough: { |
| 33 | + description: ` |
| 34 | + <p> |
| 35 | + If the delay argument is a Number, this operator time shifts the source Observable by that amount |
| 36 | + of time expressed in milliseconds. The relative time intervale between the values are preserved. |
| 37 | + </p> |
| 38 | + <p> |
| 39 | + If the delay argument is a Date, this operator time shifts the start of the Observable execution |
| 40 | + until the given date occurs. |
| 41 | + </p> |
| 42 | + ` |
| 43 | + }, |
| 44 | + examples: [ |
| 45 | + { |
| 46 | + name: 'Delay each click by one second', |
| 47 | + code: ` |
| 48 | + const clicks = Rx.Observable.fromEvent(document, 'click').mapTo('click');; |
| 49 | + const delayedClicks = clicks.delay(1000); |
| 50 | + delayedClicks.subscribe(x => console.log(x)); |
| 51 | + `, |
| 52 | + externalLink: { |
| 53 | + platform: 'JSBin', |
| 54 | + url: 'http://jsbin.com/howeziyoma/embed?js,console,output' |
| 55 | + } |
| 56 | + }, |
| 57 | + { |
| 58 | + name: 'Delay all clicks until a future date happens', |
| 59 | + code: ` |
| 60 | + const clicks = Rx.Observable.fromEvent(document, 'click'); |
| 61 | + const date = new Date('March 15, 2050 12:00:00'); |
| 62 | + const delayedClicks = clicks.delay(date); |
| 63 | + delayedClicks.subscribe(x => console.log(x)); |
| 64 | + `, |
| 65 | + externalLink: { |
| 66 | + platform: 'JSBin', |
| 67 | + url: 'http://jsbin.com/cozogifayu/embed?js,console,output' |
| 68 | + } |
| 69 | + } |
| 70 | + ], |
| 71 | + relatedOperators: ['debounceTime', 'delayWhen'], |
| 72 | + additionalResources: [] |
6 | 73 | }; |
0 commit comments