@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,428 lines • 200 kB
JSON
{
"type": "Program",
"body": [
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "OuterSubscriber",
"range": [
9,
24
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 24
}
}
},
"imported": {
"type": "Identifier",
"name": "OuterSubscriber",
"range": [
9,
24
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 24
}
}
},
"range": [
9,
24
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 24
}
}
}
],
"source": {
"type": "Literal",
"value": "../OuterSubscriber",
"raw": "'../OuterSubscriber'",
"range": [
32,
52
],
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 52
}
}
},
"range": [
0,
53
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 53
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "subscribeToResult",
"range": [
63,
80
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 26
}
}
},
"imported": {
"type": "Identifier",
"name": "subscribeToResult",
"range": [
63,
80
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 26
}
}
},
"range": [
63,
80
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 26
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/subscribeToResult",
"raw": "'../util/subscribeToResult'",
"range": [
88,
115
],
"loc": {
"start": {
"line": 2,
"column": 34
},
"end": {
"line": 2,
"column": 61
}
}
},
"range": [
54,
116
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 62
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Emits a value from the source Observable, then ignores subsequent source\n * values for a duration determined by another Observable, then repeats this\n * process.\n *\n * <span class=\"informal\">It's like {@link throttleTime}, but the silencing\n * duration is determined by a second Observable.</span>\n *\n * <img src=\"./img/throttle.png\" width=\"100%\">\n *\n * `throttle` emits the source Observable values on the output Observable\n * when its internal timer is disabled, and ignores source values when the timer\n * is enabled. Initially, the timer is disabled. As soon as the first source\n * value arrives, it is forwarded to the output Observable, and then the timer\n * is enabled by calling the `durationSelector` function with the source value,\n * which returns the \"duration\" Observable. When the duration Observable emits a\n * value or completes, the timer is disabled, and this process repeats for the\n * next source value.\n *\n * @example <caption>Emit clicks at a rate of at most one click per second</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.throttle(ev => Rx.Observable.interval(1000));\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link delayWhen}\n * @see {@link sample}\n * @see {@link throttleTime}\n *\n * @param {function(value: T): Observable|Promise} durationSelector A function\n * that receives a value from the source Observable, for computing the silencing\n * duration for each source value, returned as an Observable or a Promise.\n * @return {Observable<T>} An Observable that performs the throttle operation to\n * limit the rate of emissions from the source.\n * @method throttle\n * @owner Observable\n ",
"range": [
117,
1846
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 40,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "throttle",
"range": [
1863,
1871
],
"loc": {
"start": {
"line": 41,
"column": 16
},
"end": {
"line": 41,
"column": 24
}
}
},
"params": [
{
"type": "Identifier",
"name": "durationSelector",
"range": [
1872,
1888
],
"loc": {
"start": {
"line": 41,
"column": 25
},
"end": {
"line": 41,
"column": 41
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1903,
1907
],
"loc": {
"start": {
"line": 42,
"column": 11
},
"end": {
"line": 42,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
1908,
1912
],
"loc": {
"start": {
"line": 42,
"column": 16
},
"end": {
"line": 42,
"column": 20
}
}
},
"range": [
1903,
1912
],
"loc": {
"start": {
"line": 42,
"column": 11
},
"end": {
"line": 42,
"column": 20
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "ThrottleOperator",
"range": [
1917,
1933
],
"loc": {
"start": {
"line": 42,
"column": 25
},
"end": {
"line": 42,
"column": 41
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "durationSelector",
"range": [
1934,
1950
],
"loc": {
"start": {
"line": 42,
"column": 42
},
"end": {
"line": 42,
"column": 58
}
}
}
],
"range": [
1913,
1951
],
"loc": {
"start": {
"line": 42,
"column": 21
},
"end": {
"line": 42,
"column": 59
}
}
}
],
"range": [
1903,
1952
],
"loc": {
"start": {
"line": 42,
"column": 11
},
"end": {
"line": 42,
"column": 60
}
}
},
"range": [
1896,
1953
],
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 61
}
}
}
],
"range": [
1890,
1955
],
"loc": {
"start": {
"line": 41,
"column": 43
},
"end": {
"line": 43,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1854,
1955
],
"loc": {
"start": {
"line": 41,
"column": 7
},
"end": {
"line": 43,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits a value from the source Observable, then ignores subsequent source\n * values for a duration determined by another Observable, then repeats this\n * process.\n *\n * <span class=\"informal\">It's like {@link throttleTime}, but the silencing\n * duration is determined by a second Observable.</span>\n *\n * <img src=\"./img/throttle.png\" width=\"100%\">\n *\n * `throttle` emits the source Observable values on the output Observable\n * when its internal timer is disabled, and ignores source values when the timer\n * is enabled. Initially, the timer is disabled. As soon as the first source\n * value arrives, it is forwarded to the output Observable, and then the timer\n * is enabled by calling the `durationSelector` function with the source value,\n * which returns the \"duration\" Observable. When the duration Observable emits a\n * value or completes, the timer is disabled, and this process repeats for the\n * next source value.\n *\n * @example <caption>Emit clicks at a rate of at most one click per second</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.throttle(ev => Rx.Observable.interval(1000));\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link delayWhen}\n * @see {@link sample}\n * @see {@link throttleTime}\n *\n * @param {function(value: T): Observable|Promise} durationSelector A function\n * that receives a value from the source Observable, for computing the silencing\n * duration for each source value, returned as an Observable or a Promise.\n * @return {Observable<T>} An Observable that performs the throttle operation to\n * limit the rate of emissions from the source.\n * @method throttle\n * @owner Observable\n ",
"range": [
117,
1846
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 40,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
1847,
1955
],
"loc": {
"start": {
"line": 41,
"column": 0
},
"end": {
"line": 43,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits a value from the source Observable, then ignores subsequent source\n * values for a duration determined by another Observable, then repeats this\n * process.\n *\n * <span class=\"informal\">It's like {@link throttleTime}, but the silencing\n * duration is determined by a second Observable.</span>\n *\n * <img src=\"./img/throttle.png\" width=\"100%\">\n *\n * `throttle` emits the source Observable values on the output Observable\n * when its internal timer is disabled, and ignores source values when the timer\n * is enabled. Initially, the timer is disabled. As soon as the first source\n * value arrives, it is forwarded to the output Observable, and then the timer\n * is enabled by calling the `durationSelector` function with the source value,\n * which returns the \"duration\" Observable. When the duration Observable emits a\n * value or completes, the timer is disabled, and this process repeats for the\n * next source value.\n *\n * @example <caption>Emit clicks at a rate of at most one click per second</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.throttle(ev => Rx.Observable.interval(1000));\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link delayWhen}\n * @see {@link sample}\n * @see {@link throttleTime}\n *\n * @param {function(value: T): Observable|Promise} durationSelector A function\n * that receives a value from the source Observable, for computing the silencing\n * duration for each source value, returned as an Observable or a Promise.\n * @return {Observable<T>} An Observable that performs the throttle operation to\n * limit the rate of emissions from the source.\n * @method throttle\n * @owner Observable\n ",
"range": [
117,
1846
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 40,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "ThrottleOperator",
"range": [
1960,
1976
],
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 20
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "ThrottleOperator",
"range": [
2007,
2023
],
"loc": {
"start": {
"line": 45,
"column": 13
},
"end": {
"line": 45,
"column": 29
}
}
},
"params": [
{
"type": "Identifier",
"name": "durationSelector",
"range": [
2024,
2040
],
"loc": {
"start": {
"line": 45,
"column": 30
},
"end": {
"line": 45,
"column": 46
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2052,
2056
],
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "durationSelector",
"range": [
2057,
2073
],
"loc": {
"start": {
"line": 46,
"column": 13
},
"end": {
"line": 46,
"column": 29
}
}
},
"range": [
2052,
2073
],
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 29
}
}
},
"right": {
"type": "Identifier",
"name": "durationSelector",
"range": [
2076,
2092
],
"loc": {
"start": {
"line": 46,
"column": 32
},
"end": {
"line": 46,
"column": 48
}
}
},
"range": [
2052,
2092
],
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 48
}
}
},
"range": [
2052,
2093
],
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 49
}
}
}
],
"range": [
2042,
2099
],
"loc": {
"start": {
"line": 45,
"column": 48
},
"end": {
"line": 47,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
1998,
2099
],
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 47,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "ThrottleOperator",
"range": [
2104,
2120
],
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 48,
"column": 20
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
2121,
2130
],
"loc": {
"start": {
"line": 48,
"column": 21
},
"end": {
"line": 48,
"column": 30
}
}
},
"range": [
2104,
2130
],
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 48,
"column": 30
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
2131,
2135
],
"loc": {
"start": {
"line": 48,
"column": 31
},
"end": {
"line": 48,
"column": 35
}
}
},
"range": [
2104,
2135
],
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 48,
"column": 35
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2148,
2158
],
"loc": {
"start": {
"line": 48,
"column": 48
},
"end": {
"line": 48,
"column": 58
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
2160,
2166
],
"loc": {
"start": {
"line": 48,
"column": 60
},
"end": {
"line": 48,
"column": 66
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
2185,
2191
],
"loc": {
"start": {
"line": 49,
"column": 15
},
"end": {
"line": 49,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
2192,
2202
],
"loc": {
"start": {
"line": 49,
"column": 22
},
"end": {
"line": 49,
"column": 32
}
}
},
"range": [
2185,
2202
],
"loc": {
"start": {
"line": 49,
"column": 15
},
"end": {
"line": 49,
"column": 32
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "ThrottleSubscriber",
"range": [
2207,
2225
],
"loc": {
"start": {
"line": 49,
"column": 37
},
"end": {
"line": 49,
"column": 55
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2226,
2236
],
"loc": {
"start": {
"line": 49,
"column": 56
},
"end": {
"line": 49,
"column": 66
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2238,
2242
],
"loc": {
"start": {
"line": 49,
"column": 68
},
"end": {
"line": 49,
"column": 72
}
}
},
"property": {
"type": "Identifier",
"name": "durationSelector",
"range": [
2243,
2259
],
"loc": {
"start": {
"line": 49,
"column": 73
},
"end": {
"line": 49,
"column": 89
}
}
},
"range": [
2238,
2259
],
"loc": {
"start": {
"line": 49,
"column": 68
},
"end": {
"line": 49,
"column": 89
}
}
}
],
"range": [
2203,
2260
],
"loc": {
"start": {
"line": 49,
"column": 33
},
"end": {
"line": 49,
"column": 90
}
}
}
],
"range": [
2185,
2261
],
"loc": {
"start": {
"line": 49,
"column": 15
},
"end": {
"line": 49,
"column": 91
}
}
},
"range": [
2178,
2262
],
"loc": {
"start": {
"line": 49,
"column": 8
},
"end": {
"line": 49,
"column": 92
}
}
}
],
"range": [
2168,
2268
],
"loc": {
"start": {
"line": 48,
"column": 68
},
"end": {
"line": 50,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
2138,
2268
],
"loc": {
"start": {
"line": 48,
"column": 38
},
"end": {
"line": 50,
"column": 5
}
}
},
"range": [
2104,
2268
],
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 50,
"column": 5
}
}
},
"range": [
2104,
2269
],
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 50,
"column": 6
}
}
},
{
"type": "ReturnStatement",
"argument": {
"type": "Identifier",
"name": "ThrottleOperator",
"range": [
2281,
2297
],
"loc": {
"start": {
"line": 51,
"column": 11
},
"end": {
"line": 51,
"column": 27
}
}
},
"range": [
2274,
2298
],
"loc": {
"start": {
"line": 51,
"column": 4
},
"end": {
"line": 51,
"column": 28
}
}
}
],
"range": [
1992,
2300
],
"loc": {
"start": {
"line": 44,
"column": 36
},
"end": {
"line": 52,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1980,
2300
],
"loc": {
"start": {
"line": 44,
"column": 24
},
"end": {
"line": 52,
"column": 1
}
}
},
"arguments": [],
"range": [
1980,
2302
],
"loc": {
"start": {
"line": 44,
"column": 24
},
"end": {
"line": 52,
"column": 3
}
}
},
"range": [
1960,
2303
],
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 52,
"column": 4
}
}
}
],
"kind": "var",
"range": [
1956,
2304
],
"loc": {
"start": {
"line": 44,
"column": 0
},
"end": {
"line": 52,
"column": 5
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n ",
"range": [
2305,
2396
],
"loc": {
"start": {
"line": 53,
"column": 0
},
"end": {
"line": 57,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "ThrottleSubscriber",
"range": [
2401,
2419
],
"loc": {
"start": {
"line": 58,
"column": 4
},
"end": {
"line": 58,
"column": 22
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "_super",
"range": [
2433,
2439
],
"loc": {
"start": {
"line": 58,
"column": 36
},
"end": {
"line": 58,
"column": 42
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "__extends",
"range": [
2447,
2456
],
"loc": {
"start": {
"line": 59,
"column": 4
},
"end": {
"line": 59,
"column": 13
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "ThrottleSubscriber",
"range": [
2457,
2475
],
"loc": {
"start": {
"line": 59,
"column": 14
},
"end": {
"line": 59,
"column": 32
}
}
},
{
"type": "Identifier",
"name": "_super",
"range": [
2477,
2483
],
"loc": {
"start": {
"line": 59,
"column": 34
},
"end": {
"line": 59,
"column": 40
}
}
}
],
"range": [
2447,
2484
],
"loc": {
"start": {
"line": 59,
"column": 4
},
"end": {
"line": 59,
"column": 41
}
}
},
"range": [
2447,
2485
],
"loc": {
"start": {
"line": 59,
"column": 4
},
"end": {
"line": 59,
"column": 42
}
}
},
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "ThrottleSubscriber",
"range": [
2499,
2517
],
"loc": {
"start": {
"line": 60,
"column": 13
},
"end": {
"line": 60,
"column": 31
}
}
},
"params": [
{
"type": "Identifier",
"name": "destination",
"range": [
2518,
2529
],
"loc": {
"start": {
"line": 60,
"column": 32
},
"end": {
"line": 60,
"column": 43
}
}
},
{
"type": "Identifier",
"name": "durationSelector",
"range": [
2531,
2547
],
"loc": {
"start": {
"line": 60,
"column": 45
},
"