UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,349 lines (1,348 loc) 222 kB
{ "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 only after a particular time span\n * has passed without another source emission.\n *\n * <span class=\"informal\">It's like {@link delay}, but passes only the most\n * recent value from each burst of emissions.</span>\n *\n * <img src=\"./img/debounceTime.png\" width=\"100%\">\n *\n * `debounceTime` delays values emitted by the source Observable, but drops\n * previous pending delayed emissions if a new value arrives on the source\n * Observable. This operator keeps track of the most recent value from the\n * source Observable, and emits that only when `dueTime` enough time has passed\n * without any other value appearing on the source Observable. If a new value\n * appears before `dueTime` silence occurs, the previous value will be dropped\n * and will not be emitted on the output Observable.\n *\n * This is a rate-limiting operator, because it is impossible for more than one\n * value to be emitted in any time window of duration `dueTime`, but it is also\n * a delay-like operator since output emissions do not occur at the same time as\n * they did on the source Observable. Optionally takes a {@link Scheduler} for\n * managing timers.\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.debounceTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounce}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttleTime}\n *\n * @param {number} dueTime The timeout duration in milliseconds (or the time\n * unit determined internally by the optional `scheduler`) for the window of\n * time required to wait for emission silence before emitting the most recent\n * source value.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the timeout for each value.\n * @return {Observable} An Observable that delays the emissions of the source\n * Observable by the specified `dueTime`, and may drop some values if they occur\n * too frequently.\n * @method debounceTime\n * @owner Observable\n ", "range": [ 88, 2241 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 48, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "debounceTime", "range": [ 2258, 2270 ], "loc": { "start": { "line": 49, "column": 16 }, "end": { "line": 49, "column": 28 } } }, "params": [ { "type": "Identifier", "name": "dueTime", "range": [ 2271, 2278 ], "loc": { "start": { "line": 49, "column": 29 }, "end": { "line": 49, "column": 36 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 2280, 2289 ], "loc": { "start": { "line": 49, "column": 38 }, "end": { "line": 49, "column": 47 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "IfStatement", "test": { "type": "BinaryExpression", "operator": "===", "left": { "type": "Identifier", "name": "scheduler", "range": [ 2301, 2310 ], "loc": { "start": { "line": 50, "column": 8 }, "end": { "line": 50, "column": 17 } } }, "right": { "type": "UnaryExpression", "operator": "void", "argument": { "type": "Literal", "value": 0, "raw": "0", "range": [ 2320, 2321 ], "loc": { "start": { "line": 50, "column": 27 }, "end": { "line": 50, "column": 28 } } }, "prefix": true, "range": [ 2315, 2321 ], "loc": { "start": { "line": 50, "column": 22 }, "end": { "line": 50, "column": 28 } } }, "range": [ 2301, 2321 ], "loc": { "start": { "line": 50, "column": 8 }, "end": { "line": 50, "column": 28 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "Identifier", "name": "scheduler", "range": [ 2325, 2334 ], "loc": { "start": { "line": 50, "column": 32 }, "end": { "line": 50, "column": 41 } } }, "right": { "type": "Identifier", "name": "async", "range": [ 2337, 2342 ], "loc": { "start": { "line": 50, "column": 44 }, "end": { "line": 50, "column": 49 } } }, "range": [ 2325, 2342 ], "loc": { "start": { "line": 50, "column": 32 }, "end": { "line": 50, "column": 49 } } }, "range": [ 2325, 2343 ], "loc": { "start": { "line": 50, "column": 32 }, "end": { "line": 50, "column": 50 } } } ], "range": [ 2323, 2345 ], "loc": { "start": { "line": 50, "column": 30 }, "end": { "line": 50, "column": 52 } } }, "alternate": null, "range": [ 2297, 2345 ], "loc": { "start": { "line": 50, "column": 4 }, "end": { "line": 50, "column": 52 } } }, { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2357, 2361 ], "loc": { "start": { "line": 51, "column": 11 }, "end": { "line": 51, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 2362, 2366 ], "loc": { "start": { "line": 51, "column": 16 }, "end": { "line": 51, "column": 20 } } }, "range": [ 2357, 2366 ], "loc": { "start": { "line": 51, "column": 11 }, "end": { "line": 51, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "DebounceTimeOperator", "range": [ 2371, 2391 ], "loc": { "start": { "line": 51, "column": 25 }, "end": { "line": 51, "column": 45 } } }, "arguments": [ { "type": "Identifier", "name": "dueTime", "range": [ 2392, 2399 ], "loc": { "start": { "line": 51, "column": 46 }, "end": { "line": 51, "column": 53 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 2401, 2410 ], "loc": { "start": { "line": 51, "column": 55 }, "end": { "line": 51, "column": 64 } } } ], "range": [ 2367, 2411 ], "loc": { "start": { "line": 51, "column": 21 }, "end": { "line": 51, "column": 65 } } } ], "range": [ 2357, 2412 ], "loc": { "start": { "line": 51, "column": 11 }, "end": { "line": 51, "column": 66 } } }, "range": [ 2350, 2413 ], "loc": { "start": { "line": 51, "column": 4 }, "end": { "line": 51, "column": 67 } } } ], "range": [ 2291, 2415 ], "loc": { "start": { "line": 49, "column": 49 }, "end": { "line": 52, "column": 1 } } }, "generator": false, "expression": false, "range": [ 2249, 2415 ], "loc": { "start": { "line": 49, "column": 7 }, "end": { "line": 52, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Emits a value from the source Observable only after a particular time span\n * has passed without another source emission.\n *\n * <span class=\"informal\">It's like {@link delay}, but passes only the most\n * recent value from each burst of emissions.</span>\n *\n * <img src=\"./img/debounceTime.png\" width=\"100%\">\n *\n * `debounceTime` delays values emitted by the source Observable, but drops\n * previous pending delayed emissions if a new value arrives on the source\n * Observable. This operator keeps track of the most recent value from the\n * source Observable, and emits that only when `dueTime` enough time has passed\n * without any other value appearing on the source Observable. If a new value\n * appears before `dueTime` silence occurs, the previous value will be dropped\n * and will not be emitted on the output Observable.\n *\n * This is a rate-limiting operator, because it is impossible for more than one\n * value to be emitted in any time window of duration `dueTime`, but it is also\n * a delay-like operator since output emissions do not occur at the same time as\n * they did on the source Observable. Optionally takes a {@link Scheduler} for\n * managing timers.\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.debounceTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounce}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttleTime}\n *\n * @param {number} dueTime The timeout duration in milliseconds (or the time\n * unit determined internally by the optional `scheduler`) for the window of\n * time required to wait for emission silence before emitting the most recent\n * source value.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the timeout for each value.\n * @return {Observable} An Observable that delays the emissions of the source\n * Observable by the specified `dueTime`, and may drop some values if they occur\n * too frequently.\n * @method debounceTime\n * @owner Observable\n ", "range": [ 88, 2241 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 48, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 2242, 2415 ], "loc": { "start": { "line": 49, "column": 0 }, "end": { "line": 52, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Emits a value from the source Observable only after a particular time span\n * has passed without another source emission.\n *\n * <span class=\"informal\">It's like {@link delay}, but passes only the most\n * recent value from each burst of emissions.</span>\n *\n * <img src=\"./img/debounceTime.png\" width=\"100%\">\n *\n * `debounceTime` delays values emitted by the source Observable, but drops\n * previous pending delayed emissions if a new value arrives on the source\n * Observable. This operator keeps track of the most recent value from the\n * source Observable, and emits that only when `dueTime` enough time has passed\n * without any other value appearing on the source Observable. If a new value\n * appears before `dueTime` silence occurs, the previous value will be dropped\n * and will not be emitted on the output Observable.\n *\n * This is a rate-limiting operator, because it is impossible for more than one\n * value to be emitted in any time window of duration `dueTime`, but it is also\n * a delay-like operator since output emissions do not occur at the same time as\n * they did on the source Observable. Optionally takes a {@link Scheduler} for\n * managing timers.\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.debounceTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounce}\n * @see {@link delay}\n * @see {@link sampleTime}\n * @see {@link throttleTime}\n *\n * @param {number} dueTime The timeout duration in milliseconds (or the time\n * unit determined internally by the optional `scheduler`) for the window of\n * time required to wait for emission silence before emitting the most recent\n * source value.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the timeout for each value.\n * @return {Observable} An Observable that delays the emissions of the source\n * Observable by the specified `dueTime`, and may drop some values if they occur\n * too frequently.\n * @method debounceTime\n * @owner Observable\n ", "range": [ 88, 2241 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 48, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "DebounceTimeOperator", "range": [ 2420, 2440 ], "loc": { "start": { "line": 53, "column": 4 }, "end": { "line": 53, "column": 24 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "DebounceTimeOperator", "range": [ 2471, 2491 ], "loc": { "start": { "line": 54, "column": 13 }, "end": { "line": 54, "column": 33 } } }, "params": [ { "type": "Identifier", "name": "dueTime", "range": [ 2492, 2499 ], "loc": { "start": { "line": 54, "column": 34 }, "end": { "line": 54, "column": 41 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 2501, 2510 ], "loc": { "start": { "line": 54, "column": 43 }, "end": { "line": 54, "column": 52 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2522, 2526 ], "loc": { "start": { "line": 55, "column": 8 }, "end": { "line": 55, "column": 12 } } }, "property": { "type": "Identifier", "name": "dueTime", "range": [ 2527, 2534 ], "loc": { "start": { "line": 55, "column": 13 }, "end": { "line": 55, "column": 20 } } }, "range": [ 2522, 2534 ], "loc": { "start": { "line": 55, "column": 8 }, "end": { "line": 55, "column": 20 } } }, "right": { "type": "Identifier", "name": "dueTime", "range": [ 2537, 2544 ], "loc": { "start": { "line": 55, "column": 23 }, "end": { "line": 55, "column": 30 } } }, "range": [ 2522, 2544 ], "loc": { "start": { "line": 55, "column": 8 }, "end": { "line": 55, "column": 30 } } }, "range": [ 2522, 2545 ], "loc": { "start": { "line": 55, "column": 8 }, "end": { "line": 55, "column": 31 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2554, 2558 ], "loc": { "start": { "line": 56, "column": 8 }, "end": { "line": 56, "column": 12 } } }, "property": { "type": "Identifier", "name": "scheduler", "range": [ 2559, 2568 ], "loc": { "start": { "line": 56, "column": 13 }, "end": { "line": 56, "column": 22 } } }, "range": [ 2554, 2568 ], "loc": { "start": { "line": 56, "column": 8 }, "end": { "line": 56, "column": 22 } } }, "right": { "type": "Identifier", "name": "scheduler", "range": [ 2571, 2580 ], "loc": { "start": { "line": 56, "column": 25 }, "end": { "line": 56, "column": 34 } } }, "range": [ 2554, 2580 ], "loc": { "start": { "line": 56, "column": 8 }, "end": { "line": 56, "column": 34 } } }, "range": [ 2554, 2581 ], "loc": { "start": { "line": 56, "column": 8 }, "end": { "line": 56, "column": 35 } } } ], "range": [ 2512, 2587 ], "loc": { "start": { "line": 54, "column": 54 }, "end": { "line": 57, "column": 5 } } }, "generator": false, "expression": false, "range": [ 2462, 2587 ], "loc": { "start": { "line": 54, "column": 4 }, "end": { "line": 57, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "DebounceTimeOperator", "range": [ 2592, 2612 ], "loc": { "start": { "line": 58, "column": 4 }, "end": { "line": 58, "column": 24 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 2613, 2622 ], "loc": { "start": { "line": 58, "column": 25 }, "end": { "line": 58, "column": 34 } } }, "range": [ 2592, 2622 ], "loc": { "start": { "line": 58, "column": 4 }, "end": { "line": 58, "column": 34 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 2623, 2627 ], "loc": { "start": { "line": 58, "column": 35 }, "end": { "line": 58, "column": 39 } } }, "range": [ 2592, 2627 ], "loc": { "start": { "line": 58, "column": 4 }, "end": { "line": 58, "column": 39 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "subscriber", "range": [ 2640, 2650 ], "loc": { "start": { "line": 58, "column": 52 }, "end": { "line": 58, "column": 62 } } }, { "type": "Identifier", "name": "source", "range": [ 2652, 2658 ], "loc": { "start": { "line": 58, "column": 64 }, "end": { "line": 58, "column": 70 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "source", "range": [ 2677, 2683 ], "loc": { "start": { "line": 59, "column": 15 }, "end": { "line": 59, "column": 21 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 2684, 2694 ], "loc": { "start": { "line": 59, "column": 22 }, "end": { "line": 59, "column": 32 } } }, "range": [ 2677, 2694 ], "loc": { "start": { "line": 59, "column": 15 }, "end": { "line": 59, "column": 32 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "DebounceTimeSubscriber", "range": [ 2699, 2721 ], "loc": { "start": { "line": 59, "column": 37 }, "end": { "line": 59, "column": 59 } } }, "arguments": [ { "type": "Identifier", "name": "subscriber", "range": [ 2722, 2732 ], "loc": { "start": { "line": 59, "column": 60 }, "end": { "line": 59, "column": 70 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2734, 2738 ], "loc": { "start": { "line": 59, "column": 72 }, "end": { "line": 59, "column": 76 } } }, "property": { "type": "Identifier", "name": "dueTime", "range": [ 2739, 2746 ], "loc": { "start": { "line": 59, "column": 77 }, "end": { "line": 59, "column": 84 } } }, "range": [ 2734, 2746 ], "loc": { "start": { "line": 59, "column": 72 }, "end": { "line": 59, "column": 84 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2748, 2752 ], "loc": { "start": { "line": 59, "column": 86 }, "end": { "line": 59, "column": 90