UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,396 lines (1,395 loc) 271 kB
{ "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 only after a particular time span\n * determined by another Observable has passed without another source emission.\n *\n * <span class=\"informal\">It's like {@link debounceTime}, but the time span of\n * emission silence is determined by a second Observable.</span>\n *\n * <img src=\"./img/debounce.png\" width=\"100%\">\n *\n * `debounce` delays values emitted by the source Observable, but drops previous\n * pending delayed emissions if a new value arrives on the source Observable.\n * This operator keeps track of the most recent value from the source\n * Observable, and spawns a duration Observable by calling the\n * `durationSelector` function. The value is emitted only when the duration\n * Observable emits a value or completes, and if no other value was emitted on\n * the source Observable since the duration Observable was spawned. If a new\n * value appears before the duration Observable emits, the previous value will\n * be dropped and will not be emitted on the output Observable.\n *\n * Like {@link debounceTime}, this is a rate-limiting operator, and also a\n * delay-like operator since output emissions do not necessarily occur at the\n * same time as they did on the source Observable.\n *\n * @example <caption>Emit the most recent click after a burst of clicks</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.debounce(() => Rx.Observable.interval(1000));\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounceTime}\n * @see {@link delayWhen}\n * @see {@link throttle}\n *\n * @param {function(value: T): Observable|Promise} durationSelector A function\n * that receives a value from the source Observable, for computing the timeout\n * duration for each source value, returned as an Observable or a Promise.\n * @return {Observable} An Observable that delays the emissions of the source\n * Observable by the specified duration Observable returned by\n * `durationSelector`, and may drop some values if they occur too frequently.\n * @method debounce\n * @owner Observable\n ", "range": [ 117, 2213 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 44, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "debounce", "range": [ 2230, 2238 ], "loc": { "start": { "line": 45, "column": 16 }, "end": { "line": 45, "column": 24 } } }, "params": [ { "type": "Identifier", "name": "durationSelector", "range": [ 2239, 2255 ], "loc": { "start": { "line": 45, "column": 25 }, "end": { "line": 45, "column": 41 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2270, 2274 ], "loc": { "start": { "line": 46, "column": 11 }, "end": { "line": 46, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 2275, 2279 ], "loc": { "start": { "line": 46, "column": 16 }, "end": { "line": 46, "column": 20 } } }, "range": [ 2270, 2279 ], "loc": { "start": { "line": 46, "column": 11 }, "end": { "line": 46, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "DebounceOperator", "range": [ 2284, 2300 ], "loc": { "start": { "line": 46, "column": 25 }, "end": { "line": 46, "column": 41 } } }, "arguments": [ { "type": "Identifier", "name": "durationSelector", "range": [ 2301, 2317 ], "loc": { "start": { "line": 46, "column": 42 }, "end": { "line": 46, "column": 58 } } } ], "range": [ 2280, 2318 ], "loc": { "start": { "line": 46, "column": 21 }, "end": { "line": 46, "column": 59 } } } ], "range": [ 2270, 2319 ], "loc": { "start": { "line": 46, "column": 11 }, "end": { "line": 46, "column": 60 } } }, "range": [ 2263, 2320 ], "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 61 } } } ], "range": [ 2257, 2322 ], "loc": { "start": { "line": 45, "column": 43 }, "end": { "line": 47, "column": 1 } } }, "generator": false, "expression": false, "range": [ 2221, 2322 ], "loc": { "start": { "line": 45, "column": 7 }, "end": { "line": 47, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Emits a value from the source Observable only after a particular time span\n * determined by another Observable has passed without another source emission.\n *\n * <span class=\"informal\">It's like {@link debounceTime}, but the time span of\n * emission silence is determined by a second Observable.</span>\n *\n * <img src=\"./img/debounce.png\" width=\"100%\">\n *\n * `debounce` delays values emitted by the source Observable, but drops previous\n * pending delayed emissions if a new value arrives on the source Observable.\n * This operator keeps track of the most recent value from the source\n * Observable, and spawns a duration Observable by calling the\n * `durationSelector` function. The value is emitted only when the duration\n * Observable emits a value or completes, and if no other value was emitted on\n * the source Observable since the duration Observable was spawned. If a new\n * value appears before the duration Observable emits, the previous value will\n * be dropped and will not be emitted on the output Observable.\n *\n * Like {@link debounceTime}, this is a rate-limiting operator, and also a\n * delay-like operator since output emissions do not necessarily occur at the\n * same time as they did on the source Observable.\n *\n * @example <caption>Emit the most recent click after a burst of clicks</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.debounce(() => Rx.Observable.interval(1000));\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounceTime}\n * @see {@link delayWhen}\n * @see {@link throttle}\n *\n * @param {function(value: T): Observable|Promise} durationSelector A function\n * that receives a value from the source Observable, for computing the timeout\n * duration for each source value, returned as an Observable or a Promise.\n * @return {Observable} An Observable that delays the emissions of the source\n * Observable by the specified duration Observable returned by\n * `durationSelector`, and may drop some values if they occur too frequently.\n * @method debounce\n * @owner Observable\n ", "range": [ 117, 2213 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 44, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 2214, 2322 ], "loc": { "start": { "line": 45, "column": 0 }, "end": { "line": 47, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Emits a value from the source Observable only after a particular time span\n * determined by another Observable has passed without another source emission.\n *\n * <span class=\"informal\">It's like {@link debounceTime}, but the time span of\n * emission silence is determined by a second Observable.</span>\n *\n * <img src=\"./img/debounce.png\" width=\"100%\">\n *\n * `debounce` delays values emitted by the source Observable, but drops previous\n * pending delayed emissions if a new value arrives on the source Observable.\n * This operator keeps track of the most recent value from the source\n * Observable, and spawns a duration Observable by calling the\n * `durationSelector` function. The value is emitted only when the duration\n * Observable emits a value or completes, and if no other value was emitted on\n * the source Observable since the duration Observable was spawned. If a new\n * value appears before the duration Observable emits, the previous value will\n * be dropped and will not be emitted on the output Observable.\n *\n * Like {@link debounceTime}, this is a rate-limiting operator, and also a\n * delay-like operator since output emissions do not necessarily occur at the\n * same time as they did on the source Observable.\n *\n * @example <caption>Emit the most recent click after a burst of clicks</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.debounce(() => Rx.Observable.interval(1000));\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounceTime}\n * @see {@link delayWhen}\n * @see {@link throttle}\n *\n * @param {function(value: T): Observable|Promise} durationSelector A function\n * that receives a value from the source Observable, for computing the timeout\n * duration for each source value, returned as an Observable or a Promise.\n * @return {Observable} An Observable that delays the emissions of the source\n * Observable by the specified duration Observable returned by\n * `durationSelector`, and may drop some values if they occur too frequently.\n * @method debounce\n * @owner Observable\n ", "range": [ 117, 2213 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 44, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "DebounceOperator", "range": [ 2327, 2343 ], "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 48, "column": 20 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "DebounceOperator", "range": [ 2374, 2390 ], "loc": { "start": { "line": 49, "column": 13 }, "end": { "line": 49, "column": 29 } } }, "params": [ { "type": "Identifier", "name": "durationSelector", "range": [ 2391, 2407 ], "loc": { "start": { "line": 49, "column": 30 }, "end": { "line": 49, "column": 46 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2419, 2423 ], "loc": { "start": { "line": 50, "column": 8 }, "end": { "line": 50, "column": 12 } } }, "property": { "type": "Identifier", "name": "durationSelector", "range": [ 2424, 2440 ], "loc": { "start": { "line": 50, "column": 13 }, "end": { "line": 50, "column": 29 } } }, "range": [ 2419, 2440 ], "loc": { "start": { "line": 50, "column": 8 }, "end": { "line": 50, "column": 29 } } }, "right": { "type": "Identifier", "name": "durationSelector", "range": [ 2443, 2459 ], "loc": { "start": { "line": 50, "column": 32 }, "end": { "line": 50, "column": 48 } } }, "range": [ 2419, 2459 ], "loc": { "start": { "line": 50, "column": 8 }, "end": { "line": 50, "column": 48 } } }, "range": [ 2419, 2460 ], "loc": { "start": { "line": 50, "column": 8 }, "end": { "line": 50, "column": 49 } } } ], "range": [ 2409, 2466 ], "loc": { "start": { "line": 49, "column": 48 }, "end": { "line": 51, "column": 5 } } }, "generator": false, "expression": false, "range": [ 2365, 2466 ], "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 51, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "DebounceOperator", "range": [ 2471, 2487 ], "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 52, "column": 20 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 2488, 2497 ], "loc": { "start": { "line": 52, "column": 21 }, "end": { "line": 52, "column": 30 } } }, "range": [ 2471, 2497 ], "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 52, "column": 30 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 2498, 2502 ], "loc": { "start": { "line": 52, "column": 31 }, "end": { "line": 52, "column": 35 } } }, "range": [ 2471, 2502 ], "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 52, "column": 35 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "subscriber", "range": [ 2515, 2525 ], "loc": { "start": { "line": 52, "column": 48 }, "end": { "line": 52, "column": 58 } } }, { "type": "Identifier", "name": "source", "range": [ 2527, 2533 ], "loc": { "start": { "line": 52, "column": 60 }, "end": { "line": 52, "column": 66 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "source", "range": [ 2552, 2558 ], "loc": { "start": { "line": 53, "column": 15 }, "end": { "line": 53, "column": 21 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 2559, 2569 ], "loc": { "start": { "line": 53, "column": 22 }, "end": { "line": 53, "column": 32 } } }, "range": [ 2552, 2569 ], "loc": { "start": { "line": 53, "column": 15 }, "end": { "line": 53, "column": 32 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "DebounceSubscriber", "range": [ 2574, 2592 ], "loc": { "start": { "line": 53, "column": 37 }, "end": { "line": 53, "column": 55 } } }, "arguments": [ { "type": "Identifier", "name": "subscriber", "range": [ 2593, 2603 ], "loc": { "start": { "line": 53, "column": 56 }, "end": { "line": 53, "column": 66 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2605, 2609 ], "loc": { "start": { "line": 53, "column": 68 }, "end": { "line": 53, "column": 72 } } }, "property": { "type": "Identifier", "name": "durationSelector", "range": [ 2610, 2626 ], "loc": { "start": { "line": 53, "column": 73 }, "end": { "line": 53, "column": 89 } } }, "range": [ 2605, 2626 ], "loc": { "start": { "line": 53, "column": 68 }, "end": { "line": 53, "column": 89 } } } ], "range": [ 2570, 2627 ], "loc": { "start": { "line": 53, "column": 33 }, "end": { "line": 53, "column": 90 } } } ], "range": [ 2552, 2628 ], "loc": { "start": { "line": 53, "column": 15 }, "end": { "line": 53, "column": 91 } } }, "range": [ 2545, 2629 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 92 } } } ], "range": [ 2535, 2635 ], "loc": { "start": { "line": 52, "column": 68 }, "end": { "line": 54, "column": 5 } } }, "generator": false, "expression": false, "range": [ 2505, 2635 ], "loc": { "start": { "line": 52, "column": 38 }, "end": { "line": 54, "column": 5 } } }, "range": [ 2471, 2635 ], "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 54, "column": 5 } } }, "range": [ 2471, 2636 ], "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 54, "column": 6 } } }, { "type": "ReturnStatement", "argument": { "type": "Identifier", "name": "DebounceOperator", "range": [ 2648, 2664 ], "loc": { "start": { "line": 55, "column": 11 }, "end": { "line": 55, "column": 27 } } }, "range": [ 2641, 2665 ], "loc": { "start": { "line": 55, "column": 4 }, "end": { "line": 55, "column": 28 } } } ], "range": [ 2359, 2667 ], "loc": { "start": { "line": 48, "column": 36 }, "end": { "line": 56, "column": 1 } } }, "generator": false, "expression": false, "range": [ 2347, 2667 ], "loc": { "start": { "line": 48, "column": 24 }, "end": { "line": 56, "column": 1 } } }, "arguments": [], "range": [ 2347, 2669 ], "loc": { "start": { "line": 48, "column": 24 }, "end": { "line": 56, "column": 3 } } }, "range": [ 2327, 2670 ], "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 56, "column": 4 } } } ], "kind": "var", "range": [ 2323, 2671 ], "loc": { "start": { "line": 48, "column": 0 }, "end": { "line": 56, "column": 5 } }, "trailingComments": [ { "type": "Block", "value": "*\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n ", "range": [ 2672, 2763 ], "loc": { "start": { "line": 57, "column": 0 }, "end": { "line": 61, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "DebounceSubscriber", "range": [ 2768, 2786 ], "loc": { "start": { "line": 62, "column": 4 }, "end": { "line": 62, "column": 22 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "_super", "range": [ 2800, 2806 ], "loc": { "start": { "line": 62, "column": 36 }, "end": { "line": 62, "column": 42 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "Identifier", "name": "__extends", "range": [ 2814, 2823 ], "loc": { "start": { "line": 63, "column": 4 }, "end": { "line": 63, "column": 13 } } }, "arguments": [ { "type": "Identifier", "name": "DebounceSubscriber", "range": [ 2824, 2842 ], "loc": { "start": { "line": 63, "column": 14 }, "end": { "line": 63, "column": 32 } } }, { "type": "Identifier", "name": "_super", "range": [ 2844, 2850 ], "loc": { "start": { "line": 63, "column": 34 }, "end": { "line": 63, "column": 40 } } } ], "range": [ 2814, 2851 ], "loc": { "start": { "line": 63, "column": 4 }, "end": { "line": 63, "column": 41 } } }, "range": [ 2814, 2852 ], "loc": { "start": { "line": 63, "column": 4 }, "end": { "line": 63, "column": 42 } } }, { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "DebounceSubscriber", "range": [ 2866, 2884 ], "loc": { "start": { "line": 64, "column": 13 }, "end": { "line": 64, "column": 31 } }