@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,371 lines (1,370 loc) • 164 kB
JSON
{
"type": "Program",
"body": [
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "Subscriber",
"range": [
9,
19
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 19
}
}
},
"imported": {
"type": "Identifier",
"name": "Subscriber",
"range": [
9,
19
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 19
}
}
},
"range": [
9,
19
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 19
}
}
}
],
"source": {
"type": "Literal",
"value": "../Subscriber",
"raw": "'../Subscriber'",
"range": [
27,
42
],
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 42
}
}
},
"range": [
0,
43
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 43
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "async",
"range": [
53,
58
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
}
},
"imported": {
"type": "Identifier",
"name": "async",
"range": [
53,
58
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
}
},
"range": [
53,
58
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
}
}
],
"source": {
"type": "Literal",
"value": "../scheduler/async",
"raw": "'../scheduler/async'",
"range": [
66,
86
],
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 42
}
}
},
"range": [
44,
87
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 43
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Emits a value from the source Observable, then ignores subsequent source\n * values for `duration` milliseconds, then repeats this process.\n *\n * <span class=\"informal\">Lets a value pass, then ignores source values for the\n * next `duration` milliseconds.</span>\n *\n * <img src=\"./img/throttleTime.png\" width=\"100%\">\n *\n * `throttleTime` 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. After `duration` milliseconds (or the time unit determined\n * internally by the optional `scheduler`) has passed, the timer is disabled,\n * and this process repeats for the next source value. Optionally takes a\n * {@link Scheduler} for managing timers.\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.throttleTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param {number} duration Time to wait before emitting another value after\n * emitting the last value, measured in milliseconds or the time unit determined\n * internally by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the sampling.\n * @return {Observable<T>} An Observable that performs the throttle operation to\n * limit the rate of emissions from the source.\n * @method throttleTime\n * @owner Observable\n ",
"range": [
88,
1865
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 41,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "throttleTime",
"range": [
1882,
1894
],
"loc": {
"start": {
"line": 42,
"column": 16
},
"end": {
"line": 42,
"column": 28
}
}
},
"params": [
{
"type": "Identifier",
"name": "duration",
"range": [
1895,
1903
],
"loc": {
"start": {
"line": 42,
"column": 29
},
"end": {
"line": 42,
"column": 37
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
1905,
1914
],
"loc": {
"start": {
"line": 42,
"column": 39
},
"end": {
"line": 42,
"column": 48
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "IfStatement",
"test": {
"type": "BinaryExpression",
"operator": "===",
"left": {
"type": "Identifier",
"name": "scheduler",
"range": [
1926,
1935
],
"loc": {
"start": {
"line": 43,
"column": 8
},
"end": {
"line": 43,
"column": 17
}
}
},
"right": {
"type": "UnaryExpression",
"operator": "void",
"argument": {
"type": "Literal",
"value": 0,
"raw": "0",
"range": [
1945,
1946
],
"loc": {
"start": {
"line": 43,
"column": 27
},
"end": {
"line": 43,
"column": 28
}
}
},
"prefix": true,
"range": [
1940,
1946
],
"loc": {
"start": {
"line": 43,
"column": 22
},
"end": {
"line": 43,
"column": 28
}
}
},
"range": [
1926,
1946
],
"loc": {
"start": {
"line": 43,
"column": 8
},
"end": {
"line": 43,
"column": 28
}
}
},
"consequent": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "Identifier",
"name": "scheduler",
"range": [
1950,
1959
],
"loc": {
"start": {
"line": 43,
"column": 32
},
"end": {
"line": 43,
"column": 41
}
}
},
"right": {
"type": "Identifier",
"name": "async",
"range": [
1962,
1967
],
"loc": {
"start": {
"line": 43,
"column": 44
},
"end": {
"line": 43,
"column": 49
}
}
},
"range": [
1950,
1967
],
"loc": {
"start": {
"line": 43,
"column": 32
},
"end": {
"line": 43,
"column": 49
}
}
},
"range": [
1950,
1968
],
"loc": {
"start": {
"line": 43,
"column": 32
},
"end": {
"line": 43,
"column": 50
}
}
}
],
"range": [
1948,
1970
],
"loc": {
"start": {
"line": 43,
"column": 30
},
"end": {
"line": 43,
"column": 52
}
}
},
"alternate": null,
"range": [
1922,
1970
],
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 52
}
}
},
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1982,
1986
],
"loc": {
"start": {
"line": 44,
"column": 11
},
"end": {
"line": 44,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
1987,
1991
],
"loc": {
"start": {
"line": 44,
"column": 16
},
"end": {
"line": 44,
"column": 20
}
}
},
"range": [
1982,
1991
],
"loc": {
"start": {
"line": 44,
"column": 11
},
"end": {
"line": 44,
"column": 20
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "ThrottleTimeOperator",
"range": [
1996,
2016
],
"loc": {
"start": {
"line": 44,
"column": 25
},
"end": {
"line": 44,
"column": 45
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "duration",
"range": [
2017,
2025
],
"loc": {
"start": {
"line": 44,
"column": 46
},
"end": {
"line": 44,
"column": 54
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
2027,
2036
],
"loc": {
"start": {
"line": 44,
"column": 56
},
"end": {
"line": 44,
"column": 65
}
}
}
],
"range": [
1992,
2037
],
"loc": {
"start": {
"line": 44,
"column": 21
},
"end": {
"line": 44,
"column": 66
}
}
}
],
"range": [
1982,
2038
],
"loc": {
"start": {
"line": 44,
"column": 11
},
"end": {
"line": 44,
"column": 67
}
}
},
"range": [
1975,
2039
],
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 68
}
}
}
],
"range": [
1916,
2041
],
"loc": {
"start": {
"line": 42,
"column": 50
},
"end": {
"line": 45,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1873,
2041
],
"loc": {
"start": {
"line": 42,
"column": 7
},
"end": {
"line": 45,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits a value from the source Observable, then ignores subsequent source\n * values for `duration` milliseconds, then repeats this process.\n *\n * <span class=\"informal\">Lets a value pass, then ignores source values for the\n * next `duration` milliseconds.</span>\n *\n * <img src=\"./img/throttleTime.png\" width=\"100%\">\n *\n * `throttleTime` 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. After `duration` milliseconds (or the time unit determined\n * internally by the optional `scheduler`) has passed, the timer is disabled,\n * and this process repeats for the next source value. Optionally takes a\n * {@link Scheduler} for managing timers.\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.throttleTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param {number} duration Time to wait before emitting another value after\n * emitting the last value, measured in milliseconds or the time unit determined\n * internally by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the sampling.\n * @return {Observable<T>} An Observable that performs the throttle operation to\n * limit the rate of emissions from the source.\n * @method throttleTime\n * @owner Observable\n ",
"range": [
88,
1865
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 41,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
1866,
2041
],
"loc": {
"start": {
"line": 42,
"column": 0
},
"end": {
"line": 45,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits a value from the source Observable, then ignores subsequent source\n * values for `duration` milliseconds, then repeats this process.\n *\n * <span class=\"informal\">Lets a value pass, then ignores source values for the\n * next `duration` milliseconds.</span>\n *\n * <img src=\"./img/throttleTime.png\" width=\"100%\">\n *\n * `throttleTime` 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. After `duration` milliseconds (or the time unit determined\n * internally by the optional `scheduler`) has passed, the timer is disabled,\n * and this process repeats for the next source value. Optionally takes a\n * {@link Scheduler} for managing timers.\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.throttleTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param {number} duration Time to wait before emitting another value after\n * emitting the last value, measured in milliseconds or the time unit determined\n * internally by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the sampling.\n * @return {Observable<T>} An Observable that performs the throttle operation to\n * limit the rate of emissions from the source.\n * @method throttleTime\n * @owner Observable\n ",
"range": [
88,
1865
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 41,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "ThrottleTimeOperator",
"range": [
2046,
2066
],
"loc": {
"start": {
"line": 46,
"column": 4
},
"end": {
"line": 46,
"column": 24
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "ThrottleTimeOperator",
"range": [
2097,
2117
],
"loc": {
"start": {
"line": 47,
"column": 13
},
"end": {
"line": 47,
"column": 33
}
}
},
"params": [
{
"type": "Identifier",
"name": "duration",
"range": [
2118,
2126
],
"loc": {
"start": {
"line": 47,
"column": 34
},
"end": {
"line": 47,
"column": 42
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
2128,
2137
],
"loc": {
"start": {
"line": 47,
"column": 44
},
"end": {
"line": 47,
"column": 53
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2149,
2153
],
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "duration",
"range": [
2154,
2162
],
"loc": {
"start": {
"line": 48,
"column": 13
},
"end": {
"line": 48,
"column": 21
}
}
},
"range": [
2149,
2162
],
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 21
}
}
},
"right": {
"type": "Identifier",
"name": "duration",
"range": [
2165,
2173
],
"loc": {
"start": {
"line": 48,
"column": 24
},
"end": {
"line": 48,
"column": 32
}
}
},
"range": [
2149,
2173
],
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 32
}
}
},
"range": [
2149,
2174
],
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 33
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2183,
2187
],
"loc": {
"start": {
"line": 49,
"column": 8
},
"end": {
"line": 49,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "scheduler",
"range": [
2188,
2197
],
"loc": {
"start": {
"line": 49,
"column": 13
},
"end": {
"line": 49,
"column": 22
}
}
},
"range": [
2183,
2197
],
"loc": {
"start": {
"line": 49,
"column": 8
},
"end": {
"line": 49,
"column": 22
}
}
},
"right": {
"type": "Identifier",
"name": "scheduler",
"range": [
2200,
2209
],
"loc": {
"start": {
"line": 49,
"column": 25
},
"end": {
"line": 49,
"column": 34
}
}
},
"range": [
2183,
2209
],
"loc": {
"start": {
"line": 49,
"column": 8
},
"end": {
"line": 49,
"column": 34
}
}
},
"range": [
2183,
2210
],
"loc": {
"start": {
"line": 49,
"column": 8
},
"end": {
"line": 49,
"column": 35
}
}
}
],
"range": [
2139,
2216
],
"loc": {
"start": {
"line": 47,
"column": 55
},
"end": {
"line": 50,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
2088,
2216
],
"loc": {
"start": {
"line": 47,
"column": 4
},
"end": {
"line": 50,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "ThrottleTimeOperator",
"range": [
2221,
2241
],
"loc": {
"start": {
"line": 51,
"column": 4
},
"end": {
"line": 51,
"column": 24
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
2242,
2251
],
"loc": {
"start": {
"line": 51,
"column": 25
},
"end": {
"line": 51,
"column": 34
}
}
},
"range": [
2221,
2251
],
"loc": {
"start": {
"line": 51,
"column": 4
},
"end": {
"line": 51,
"column": 34
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
2252,
2256
],
"loc": {
"start": {
"line": 51,
"column": 35
},
"end": {
"line": 51,
"column": 39
}
}
},
"range": [
2221,
2256
],
"loc": {
"start": {
"line": 51,
"column": 4
},
"end": {
"line": 51,
"column": 39
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2269,
2279
],
"loc": {
"start": {
"line": 51,
"column": 52
},
"end": {
"line": 51,
"column": 62
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
2281,
2287
],
"loc": {
"start": {
"line": 51,
"column": 64
},
"end": {
"line": 51,
"column": 70
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
2306,
2312
],
"loc": {
"start": {
"line": 52,
"column": 15
},
"end": {
"line": 52,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
2313,
2323
],
"loc": {
"start": {
"line": 52,
"column": 22
},
"end": {
"line": 52,
"column": 32
}
}
},
"range": [
2306,
2323
],
"loc": {
"start": {
"line": 52,
"column": 15
},
"end": {
"line": 52,
"column": 32
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "ThrottleTimeSubscriber",
"range": [
2328,
2350
],
"loc": {
"start": {
"line": 52,
"column": 37
},
"end": {
"line": 52,
"column": 59
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2351,
2361
],
"loc": {
"start": {
"line": 52,
"column": 60
},
"end": {
"line": 52,
"column": 70
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2363,
2367
],
"loc": {
"start": {
"line": 52,
"column": 72
},
"end": {
"line": 52,
"column": 76
}
}
},
"property": {
"type": "Identifier",
"name": "duration",
"range": [
2368,
2376
],
"loc": {
"start": {
"line": 52,
"column": 77
},
"end": {
"line": 52,
"column": 85
}
}
},
"range": [
2363,
2376
],
"loc": {
"start": {
"line": 52,
"column": 72
},
"end": {
"line": 52,
"column": 85
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2378,
2382
],
"loc": {
"start": {
"line": 52,
"column": 87
},
"end": {
"line": 52,
"column": 91
}
}
},
"property": {
"type": "Identifier",
"name": "scheduler",
"range": [
2383,
2392
],
"loc": {
"start": {
"line": 52,
"column": 92
},
"end": {
"line": 52,
"column": 101
}
}
},
"range": [