UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,358 lines (1,357 loc) 196 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "async", "range": [ 9, 14 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 14 } } }, "imported": { "type": "Identifier", "name": "async", "range": [ 9, 14 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 14 } } }, "range": [ 9, 14 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 14 } } } ], "source": { "type": "Literal", "value": "../scheduler/async", "raw": "'../scheduler/async'", "range": [ 22, 42 ], "loc": { "start": { "line": 1, "column": 22 }, "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": "Subscriber", "range": [ 53, 63 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 19 } } }, "imported": { "type": "Identifier", "name": "Subscriber", "range": [ 53, 63 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 19 } } }, "range": [ 53, 63 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 19 } } } ], "source": { "type": "Literal", "value": "../Subscriber", "raw": "'../Subscriber'", "range": [ 71, 86 ], "loc": { "start": { "line": 2, "column": 27 }, "end": { "line": 2, "column": 42 } } }, "range": [ 44, 87 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 43 } }, "trailingComments": [ { "type": "Block", "value": "*\n * Ignores source values for `duration` milliseconds, then emits the most recent\n * value from the source Observable, then repeats this process.\n *\n * <span class=\"informal\">When it sees a source values, it ignores that plus\n * the next ones for `duration` milliseconds, and then it emits the most recent\n * value from the source.</span>\n *\n * <img src=\"./img/auditTime.png\" width=\"100%\">\n *\n * `auditTime` is similar to `throttleTime`, but emits the last value from the\n * silenced time window, instead of the first value. `auditTime` emits the most\n * recent value from the source Observable on the output Observable as soon as\n * its internal timer becomes disabled, and ignores source values while the\n * timer is enabled. Initially, the timer is disabled. As soon as the first\n * source value arrives, the timer is enabled. After `duration` milliseconds (or\n * the time unit determined internally by the optional `scheduler`) has passed,\n * the timer is disabled, then the most recent source value is emitted on the\n * output Observable, and this process repeats for the next source value.\n * Optionally takes a {@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.auditTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttleTime}\n *\n * @param {number} duration Time to wait before emitting the most recent source\n * value, measured in milliseconds or the time unit determined internally\n * by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the rate-limiting behavior.\n * @return {Observable<T>} An Observable that performs rate-limiting of\n * emissions from the source Observable.\n * @method auditTime\n * @owner Observable\n ", "range": [ 88, 2093 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 44, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "auditTime", "range": [ 2110, 2119 ], "loc": { "start": { "line": 45, "column": 16 }, "end": { "line": 45, "column": 25 } } }, "params": [ { "type": "Identifier", "name": "duration", "range": [ 2120, 2128 ], "loc": { "start": { "line": 45, "column": 26 }, "end": { "line": 45, "column": 34 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 2130, 2139 ], "loc": { "start": { "line": 45, "column": 36 }, "end": { "line": 45, "column": 45 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "IfStatement", "test": { "type": "BinaryExpression", "operator": "===", "left": { "type": "Identifier", "name": "scheduler", "range": [ 2151, 2160 ], "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 17 } } }, "right": { "type": "UnaryExpression", "operator": "void", "argument": { "type": "Literal", "value": 0, "raw": "0", "range": [ 2170, 2171 ], "loc": { "start": { "line": 46, "column": 27 }, "end": { "line": 46, "column": 28 } } }, "prefix": true, "range": [ 2165, 2171 ], "loc": { "start": { "line": 46, "column": 22 }, "end": { "line": 46, "column": 28 } } }, "range": [ 2151, 2171 ], "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 28 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "Identifier", "name": "scheduler", "range": [ 2175, 2184 ], "loc": { "start": { "line": 46, "column": 32 }, "end": { "line": 46, "column": 41 } } }, "right": { "type": "Identifier", "name": "async", "range": [ 2187, 2192 ], "loc": { "start": { "line": 46, "column": 44 }, "end": { "line": 46, "column": 49 } } }, "range": [ 2175, 2192 ], "loc": { "start": { "line": 46, "column": 32 }, "end": { "line": 46, "column": 49 } } }, "range": [ 2175, 2193 ], "loc": { "start": { "line": 46, "column": 32 }, "end": { "line": 46, "column": 50 } } } ], "range": [ 2173, 2195 ], "loc": { "start": { "line": 46, "column": 30 }, "end": { "line": 46, "column": 52 } } }, "alternate": null, "range": [ 2147, 2195 ], "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 52 } } }, { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2207, 2211 ], "loc": { "start": { "line": 47, "column": 11 }, "end": { "line": 47, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 2212, 2216 ], "loc": { "start": { "line": 47, "column": 16 }, "end": { "line": 47, "column": 20 } } }, "range": [ 2207, 2216 ], "loc": { "start": { "line": 47, "column": 11 }, "end": { "line": 47, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "AuditTimeOperator", "range": [ 2221, 2238 ], "loc": { "start": { "line": 47, "column": 25 }, "end": { "line": 47, "column": 42 } } }, "arguments": [ { "type": "Identifier", "name": "duration", "range": [ 2239, 2247 ], "loc": { "start": { "line": 47, "column": 43 }, "end": { "line": 47, "column": 51 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 2249, 2258 ], "loc": { "start": { "line": 47, "column": 53 }, "end": { "line": 47, "column": 62 } } } ], "range": [ 2217, 2259 ], "loc": { "start": { "line": 47, "column": 21 }, "end": { "line": 47, "column": 63 } } } ], "range": [ 2207, 2260 ], "loc": { "start": { "line": 47, "column": 11 }, "end": { "line": 47, "column": 64 } } }, "range": [ 2200, 2261 ], "loc": { "start": { "line": 47, "column": 4 }, "end": { "line": 47, "column": 65 } } } ], "range": [ 2141, 2263 ], "loc": { "start": { "line": 45, "column": 47 }, "end": { "line": 48, "column": 1 } } }, "generator": false, "expression": false, "range": [ 2101, 2263 ], "loc": { "start": { "line": 45, "column": 7 }, "end": { "line": 48, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Ignores source values for `duration` milliseconds, then emits the most recent\n * value from the source Observable, then repeats this process.\n *\n * <span class=\"informal\">When it sees a source values, it ignores that plus\n * the next ones for `duration` milliseconds, and then it emits the most recent\n * value from the source.</span>\n *\n * <img src=\"./img/auditTime.png\" width=\"100%\">\n *\n * `auditTime` is similar to `throttleTime`, but emits the last value from the\n * silenced time window, instead of the first value. `auditTime` emits the most\n * recent value from the source Observable on the output Observable as soon as\n * its internal timer becomes disabled, and ignores source values while the\n * timer is enabled. Initially, the timer is disabled. As soon as the first\n * source value arrives, the timer is enabled. After `duration` milliseconds (or\n * the time unit determined internally by the optional `scheduler`) has passed,\n * the timer is disabled, then the most recent source value is emitted on the\n * output Observable, and this process repeats for the next source value.\n * Optionally takes a {@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.auditTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttleTime}\n *\n * @param {number} duration Time to wait before emitting the most recent source\n * value, measured in milliseconds or the time unit determined internally\n * by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the rate-limiting behavior.\n * @return {Observable<T>} An Observable that performs rate-limiting of\n * emissions from the source Observable.\n * @method auditTime\n * @owner Observable\n ", "range": [ 88, 2093 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 44, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 2094, 2263 ], "loc": { "start": { "line": 45, "column": 0 }, "end": { "line": 48, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Ignores source values for `duration` milliseconds, then emits the most recent\n * value from the source Observable, then repeats this process.\n *\n * <span class=\"informal\">When it sees a source values, it ignores that plus\n * the next ones for `duration` milliseconds, and then it emits the most recent\n * value from the source.</span>\n *\n * <img src=\"./img/auditTime.png\" width=\"100%\">\n *\n * `auditTime` is similar to `throttleTime`, but emits the last value from the\n * silenced time window, instead of the first value. `auditTime` emits the most\n * recent value from the source Observable on the output Observable as soon as\n * its internal timer becomes disabled, and ignores source values while the\n * timer is enabled. Initially, the timer is disabled. As soon as the first\n * source value arrives, the timer is enabled. After `duration` milliseconds (or\n * the time unit determined internally by the optional `scheduler`) has passed,\n * the timer is disabled, then the most recent source value is emitted on the\n * output Observable, and this process repeats for the next source value.\n * Optionally takes a {@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.auditTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttleTime}\n *\n * @param {number} duration Time to wait before emitting the most recent source\n * value, measured in milliseconds or the time unit determined internally\n * by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the rate-limiting behavior.\n * @return {Observable<T>} An Observable that performs rate-limiting of\n * emissions from the source Observable.\n * @method auditTime\n * @owner Observable\n ", "range": [ 88, 2093 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 44, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "AuditTimeOperator", "range": [ 2268, 2285 ], "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "column": 21 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "AuditTimeOperator", "range": [ 2316, 2333 ], "loc": { "start": { "line": 50, "column": 13 }, "end": { "line": 50, "column": 30 } } }, "params": [ { "type": "Identifier", "name": "duration", "range": [ 2334, 2342 ], "loc": { "start": { "line": 50, "column": 31 }, "end": { "line": 50, "column": 39 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 2344, 2353 ], "loc": { "start": { "line": 50, "column": 41 }, "end": { "line": 50, "column": 50 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2365, 2369 ], "loc": { "start": { "line": 51, "column": 8 }, "end": { "line": 51, "column": 12 } } }, "property": { "type": "Identifier", "name": "duration", "range": [ 2370, 2378 ], "loc": { "start": { "line": 51, "column": 13 }, "end": { "line": 51, "column": 21 } } }, "range": [ 2365, 2378 ], "loc": { "start": { "line": 51, "column": 8 }, "end": { "line": 51, "column": 21 } } }, "right": { "type": "Identifier", "name": "duration", "range": [ 2381, 2389 ], "loc": { "start": { "line": 51, "column": 24 }, "end": { "line": 51, "column": 32 } } }, "range": [ 2365, 2389 ], "loc": { "start": { "line": 51, "column": 8 }, "end": { "line": 51, "column": 32 } } }, "range": [ 2365, 2390 ], "loc": { "start": { "line": 51, "column": 8 }, "end": { "line": 51, "column": 33 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2399, 2403 ], "loc": { "start": { "line": 52, "column": 8 }, "end": { "line": 52, "column": 12 } } }, "property": { "type": "Identifier", "name": "scheduler", "range": [ 2404, 2413 ], "loc": { "start": { "line": 52, "column": 13 }, "end": { "line": 52, "column": 22 } } }, "range": [ 2399, 2413 ], "loc": { "start": { "line": 52, "column": 8 }, "end": { "line": 52, "column": 22 } } }, "right": { "type": "Identifier", "name": "scheduler", "range": [ 2416, 2425 ], "loc": { "start": { "line": 52, "column": 25 }, "end": { "line": 52, "column": 34 } } }, "range": [ 2399, 2425 ], "loc": { "start": { "line": 52, "column": 8 }, "end": { "line": 52, "column": 34 } } }, "range": [ 2399, 2426 ], "loc": { "start": { "line": 52, "column": 8 }, "end": { "line": 52, "column": 35 } } } ], "range": [ 2355, 2432 ], "loc": { "start": { "line": 50, "column": 52 }, "end": { "line": 53, "column": 5 } } }, "generator": false, "expression": false, "range": [ 2307, 2432 ], "loc": { "start": { "line": 50, "column": 4 }, "end": { "line": 53, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "AuditTimeOperator", "range": [ 2437, 2454 ], "loc": { "start": { "line": 54, "column": 4 }, "end": { "line": 54, "column": 21 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 2455, 2464 ], "loc": { "start": { "line": 54, "column": 22 }, "end": { "line": 54, "column": 31 } } }, "range": [ 2437, 2464 ], "loc": { "start": { "line": 54, "column": 4 }, "end": { "line": 54, "column": 31 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 2465, 2469 ], "loc": { "start": { "line": 54, "column": 32 }, "end": { "line": 54, "column": 36 } } }, "range": [ 2437, 2469 ], "loc": { "start": { "line": 54, "column": 4 }, "end": { "line": 54, "column": 36 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "subscriber", "range": [ 2482, 2492 ], "loc": { "start": { "line": 54, "column": 49 }, "end": { "line": 54, "column": 59 } } }, { "type": "Identifier", "name": "source", "range": [ 2494, 2500 ], "loc": { "start": { "line": 54, "column": 61 }, "end": { "line": 54, "column": 67 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "source", "range": [ 2519, 2525 ], "loc": { "start": { "line": 55, "column": 15 }, "end": { "line": 55, "column": 21 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 2526, 2536 ], "loc": { "start": { "line": 55, "column": 22 }, "end": { "line": 55, "column": 32 } } }, "range": [ 2519, 2536 ], "loc": { "start": { "line": 55, "column": 15 }, "end": { "line": 55, "column": 32 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "AuditTimeSubscriber", "range": [ 2541, 2560 ], "loc": { "start": { "line": 55, "column": 37 }, "end": { "line": 55, "column": 56 } } }, "arguments": [ { "type": "Identifier", "name": "subscriber", "range": [ 2561, 2571 ], "loc": { "start": { "line": 55, "column": 57 }, "end": { "line": 55, "column": 67 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2573, 2577 ], "loc": { "start": { "line": 55, "column": 69 }, "end": { "line": 55, "column": 73 } } }, "property": { "type": "Identifier", "name": "duration", "range": [ 2578, 2586 ], "loc": { "start": { "line": 55, "column": 74 }, "end": { "line": 55, "column": 82 } } }, "range": [ 2573, 2586 ], "loc": { "start": { "line": 55, "column": 69 }, "end": { "line": 55, "column": 82 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2588, 2592 ], "loc": { "start": { "line": 55, "column": 84 }, "end": { "line": 55, "column": 88 } } }, "property": { "type": "Identifier", "name": "scheduler", "range": [ 2593, 2602