From 17315b7a10f70cd734aed4422d468da7e4c9cfbb Mon Sep 17 00:00:00 2001 From: Alexander Zulechner Date: Fri, 27 Oct 2017 16:35:23 +0200 Subject: [PATCH 1/2] docs(89): brings content for documentation of debounceTime-operator --- src/operator-docs/filtering/debounceTime.ts | 79 ++++++++++++++++++++- 1 file changed, 76 insertions(+), 3 deletions(-) diff --git a/src/operator-docs/filtering/debounceTime.ts b/src/operator-docs/filtering/debounceTime.ts index 3382612b..0ff6c617 100644 --- a/src/operator-docs/filtering/debounceTime.ts +++ b/src/operator-docs/filtering/debounceTime.ts @@ -1,6 +1,79 @@ -import { OperatorDoc } from '../operator.model'; +import { OperatorDoc } from "../operator.model"; export const debounceTime: OperatorDoc = { - 'name': 'debounceTime', - 'operatorType': 'filtering' + name: "debounceTime", + operatorType: "filtering", + signature: + "public debounceTime(dueTime: number, scheduler: IScheduler = async): Observable", + parameters: [ + { + name: "dueTime", + type: "number", + attribute: "mandatory", + description: `The timeout duration in milliseconds + (or the time unit determined internally by the optional scheduler for the window of time required to + wait for emission silence before emitting the most recent source value.` + }, + { + name: "scheduler", + type: "IScheduler", + attribute: "optional", + description: `The IScheduler to use for managing the timers that handle the timeout for each value.` + } + ], + marbleUrl: "http://reactivex.io/rxjs/img/debounceTime.png", + shortDescription: { + description: ` + Emits a value from the source Observable only after a particular time span has passed without another source emission. + It's like delay, but passes only the most recent value from each burst of emissions.`, + extras: [] + }, + walkthrough: { + description: ` +

+ debounceTime delays values emitted by the source Observable, but drops + previous pending delayed emissions if a new value arrives on the source + Observable. This operator keeps track of the most recent value from the + source Observable, and emits that only when dueTime enough time has passed + without any other value appearing on the source Observable. If a new value + appears before dueTime silence occurs, the previous value will be dropped + and will not be emitted on the output Observable. +

+

+ This is a rate-limiting operator, because it is impossible for more than one + value to be emitted in any time window of duration dueTime, but it is also + a delay-like operator since output emissions do not occur at the same time as + they did on the source Observable. Optionally takes a IScheduler for + managing timers. +

+ ` + }, + examples: [ + { + name: + "Emit the most recent value after a burst of value changes over a defined time", + code: ` + const search = document.querySelector('#search'); + const output = document.querySelector('#output'); + const searchChange$ = Rx.Observable.fromEvent(search, 'keyup'); + + searchChange$ + .map(x => x.target.value) + .debounceTime(500) + .subscribe((search)=> output.textContent=search); + `, + externalLink: { + platform: "JSBin", + url: "http://jsbin.com/gapobakuwu/edit?js,output" + } + } + ], + relatedOperators: [ + "auditTime", + "debounce", + "delay", + "sampleTime", + "throttleTime" + ], + additionalResources: [] }; From 423b35a4ee0017e26567faaa891a58e60e36f0e2 Mon Sep 17 00:00:00 2001 From: Alexander Zulechner Date: Sun, 29 Oct 2017 22:52:56 +0100 Subject: [PATCH 2/2] docs(debounceTime): adds missed closing paren and adds code-markdown class to link-tag --- src/operator-docs/filtering/debounceTime.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/operator-docs/filtering/debounceTime.ts b/src/operator-docs/filtering/debounceTime.ts index 0ff6c617..cabc3e4f 100644 --- a/src/operator-docs/filtering/debounceTime.ts +++ b/src/operator-docs/filtering/debounceTime.ts @@ -11,7 +11,7 @@ export const debounceTime: OperatorDoc = { type: "number", attribute: "mandatory", description: `The timeout duration in milliseconds - (or the time unit determined internally by the optional scheduler for the window of time required to + (or the time unit determined internally by the optional scheduler) for the window of time required to wait for emission silence before emitting the most recent source value.` }, { @@ -25,7 +25,8 @@ export const debounceTime: OperatorDoc = { shortDescription: { description: ` Emits a value from the source Observable only after a particular time span has passed without another source emission. - It's like delay, but passes only the most recent value from each burst of emissions.`, + It's like delay + , but passes only the most recent value from each burst of emissions.`, extras: [] }, walkthrough: {