From 997dcf63f3a19d1db0e1c0490689e45155ea3a29 Mon Sep 17 00:00:00 2001 From: natmegs Date: Thu, 21 Dec 2017 19:59:22 -0800 Subject: [PATCH] docs(operators): add documentation for operator delay Add initial version of documentation for utility operator 'delay' --- src/operator-docs/utility/delay.ts | 71 +++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/src/operator-docs/utility/delay.ts b/src/operator-docs/utility/delay.ts index 06a4f6b3..834e69ea 100644 --- a/src/operator-docs/utility/delay.ts +++ b/src/operator-docs/utility/delay.ts @@ -1,6 +1,73 @@ import { OperatorDoc } from '../operator.model'; export const delay: OperatorDoc = { - 'name': 'delay', - 'operatorType': 'utility' + name: 'delay', + operatorType: 'utility', + signature: + 'public delay(delay: number | Date, scheduler: Scheduler): Observable', + parameters: [ + { + name: 'delay', + type: 'number | Date', + attribute: '', + description: `The delay duration in milliseconds (a number) or a Date until which the + emission of the source items is delayed.` + }, + { + name: 'scheduer', + type: 'Scheduler', + attribute: '', + description: + 'The IScheduler to use for managing the timers that handle the time-shift for each item.' + } + ], + useInteractiveMarbles: true, + marbleUrl: 'http://reactivex.io/rxjs/img/delay.png', + shortDescription: { + description: ` + Delays the emission of items from the source Observable by a given timeout or until a given Date. + `, + extras: [] + }, + walkthrough: { + description: ` +

+ If the delay argument is a Number, this operator time shifts the source Observable by that amount + of time expressed in milliseconds. The relative time intervale between the values are preserved. +

+

+ If the delay argument is a Date, this operator time shifts the start of the Observable execution + until the given date occurs. +

+ ` + }, + examples: [ + { + name: 'Delay each click by one second', + code: ` + const clicks = Rx.Observable.fromEvent(document, 'click').mapTo('click');; + const delayedClicks = clicks.delay(1000); + delayedClicks.subscribe(x => console.log(x)); + `, + externalLink: { + platform: 'JSBin', + url: 'http://jsbin.com/howeziyoma/embed?js,console,output' + } + }, + { + name: 'Delay all clicks until a future date happens', + code: ` + const clicks = Rx.Observable.fromEvent(document, 'click'); + const date = new Date('March 15, 2050 12:00:00'); + const delayedClicks = clicks.delay(date); + delayedClicks.subscribe(x => console.log(x)); + `, + externalLink: { + platform: 'JSBin', + url: 'http://jsbin.com/cozogifayu/embed?js,console,output' + } + } + ], + relatedOperators: ['debounceTime', 'delayWhen'], + additionalResources: [] };