Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Commit 17315b7

Browse files
committed
docs(89): brings content for documentation of debounceTime-operator
1 parent 1b46319 commit 17315b7

File tree

1 file changed

+76
-3
lines changed

1 file changed

+76
-3
lines changed
Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,79 @@
1-
import { OperatorDoc } from '../operator.model';
1+
import { OperatorDoc } from "../operator.model";
22

33
export const debounceTime: OperatorDoc = {
4-
'name': 'debounceTime',
5-
'operatorType': 'filtering'
4+
name: "debounceTime",
5+
operatorType: "filtering",
6+
signature:
7+
"public debounceTime<T>(dueTime: number, scheduler: IScheduler = async): Observable",
8+
parameters: [
9+
{
10+
name: "dueTime",
11+
type: "number",
12+
attribute: "mandatory",
13+
description: `The timeout duration in milliseconds
14+
(or the time unit determined internally by the optional scheduler for the window of time required to
15+
wait for emission silence before emitting the most recent source value.`
16+
},
17+
{
18+
name: "scheduler",
19+
type: "IScheduler",
20+
attribute: "optional",
21+
description: `The IScheduler to use for managing the timers that handle the timeout for each value.`
22+
}
23+
],
24+
marbleUrl: "http://reactivex.io/rxjs/img/debounceTime.png",
25+
shortDescription: {
26+
description: `
27+
Emits a value from the source Observable only after a particular time span has passed without another source emission.
28+
It's like <a href="href="/operators#delay">delay</a>, but passes only the most recent value from each burst of emissions.`,
29+
extras: []
30+
},
31+
walkthrough: {
32+
description: `
33+
<p>
34+
<span class="markdown-code">debounceTime</span> delays values emitted by the source Observable, but drops
35+
previous pending delayed emissions if a new value arrives on the source
36+
Observable. This operator keeps track of the most recent value from the
37+
source Observable, and emits that only when <span class="markdown-code">dueTime</span> enough time has passed
38+
without any other value appearing on the source Observable. If a new value
39+
appears before <span class="markdown-code">dueTime</span> silence occurs, the previous value will be dropped
40+
and will not be emitted on the output Observable.
41+
</p>
42+
<p>
43+
This is a rate-limiting operator, because it is impossible for more than one
44+
value to be emitted in any time window of duration <span class="markdown-code">dueTime</span>, but it is also
45+
a delay-like operator since output emissions do not occur at the same time as
46+
they did on the source Observable. Optionally takes a <span class="markdown-code">IScheduler</span> for
47+
managing timers.
48+
</p>
49+
`
50+
},
51+
examples: [
52+
{
53+
name:
54+
"Emit the most recent value after a burst of value changes over a defined time",
55+
code: `
56+
const search = document.querySelector('#search');
57+
const output = document.querySelector('#output');
58+
const searchChange$ = Rx.Observable.fromEvent(search, 'keyup');
59+
60+
searchChange$
61+
.map(x => x.target.value)
62+
.debounceTime(500)
63+
.subscribe((search)=> output.textContent=search);
64+
`,
65+
externalLink: {
66+
platform: "JSBin",
67+
url: "http://jsbin.com/gapobakuwu/edit?js,output"
68+
}
69+
}
70+
],
71+
relatedOperators: [
72+
"auditTime",
73+
"debounce",
74+
"delay",
75+
"sampleTime",
76+
"throttleTime"
77+
],
78+
additionalResources: []
679
};

0 commit comments

Comments
 (0)