UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,436 lines 136 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 * Converts a higher-order Observable into a first-order Observable by dropping\n * inner Observables while the previous inner Observable has not yet completed.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables by dropping the\n * next inner Observables while the current inner is still executing.</span>\n *\n * <img src=\"./img/exhaust.png\" width=\"100%\">\n *\n * `exhaust` subscribes to an Observable that emits Observables, also known as a\n * higher-order Observable. Each time it observes one of these emitted inner\n * Observables, the output Observable begins emitting the items emitted by that\n * inner Observable. So far, it behaves like {@link mergeAll}. However,\n * `exhaust` ignores every new inner Observable if the previous Observable has\n * not yet completed. Once that one completes, it will accept and flatten the\n * next inner Observable and repeat this process.\n *\n * @example <caption>Run a finite timer for each click, only if there is no currently active timer</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));\n * var result = higherOrder.exhaust();\n * result.subscribe(x => console.log(x));\n *\n * @see {@link combineAll}\n * @see {@link concatAll}\n * @see {@link switch}\n * @see {@link mergeAll}\n * @see {@link exhaustMap}\n * @see {@link zipAll}\n *\n * @return {Observable} Returns an Observable that takes a source of Observables\n * and propagates the first observable exclusively until it completes before\n * subscribing to the next.\n * @method exhaust\n * @owner Observable\n ", "range": [ 117, 1720 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 38, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "exhaust", "range": [ 1737, 1744 ], "loc": { "start": { "line": 39, "column": 16 }, "end": { "line": 39, "column": 23 } } }, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1760, 1764 ], "loc": { "start": { "line": 40, "column": 11 }, "end": { "line": 40, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 1765, 1769 ], "loc": { "start": { "line": 40, "column": 16 }, "end": { "line": 40, "column": 20 } } }, "range": [ 1760, 1769 ], "loc": { "start": { "line": 40, "column": 11 }, "end": { "line": 40, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "SwitchFirstOperator", "range": [ 1774, 1793 ], "loc": { "start": { "line": 40, "column": 25 }, "end": { "line": 40, "column": 44 } } }, "arguments": [], "range": [ 1770, 1795 ], "loc": { "start": { "line": 40, "column": 21 }, "end": { "line": 40, "column": 46 } } } ], "range": [ 1760, 1796 ], "loc": { "start": { "line": 40, "column": 11 }, "end": { "line": 40, "column": 47 } } }, "range": [ 1753, 1797 ], "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 40, "column": 48 } } } ], "range": [ 1747, 1799 ], "loc": { "start": { "line": 39, "column": 26 }, "end": { "line": 41, "column": 1 } } }, "generator": false, "expression": false, "range": [ 1728, 1799 ], "loc": { "start": { "line": 39, "column": 7 }, "end": { "line": 41, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Converts a higher-order Observable into a first-order Observable by dropping\n * inner Observables while the previous inner Observable has not yet completed.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables by dropping the\n * next inner Observables while the current inner is still executing.</span>\n *\n * <img src=\"./img/exhaust.png\" width=\"100%\">\n *\n * `exhaust` subscribes to an Observable that emits Observables, also known as a\n * higher-order Observable. Each time it observes one of these emitted inner\n * Observables, the output Observable begins emitting the items emitted by that\n * inner Observable. So far, it behaves like {@link mergeAll}. However,\n * `exhaust` ignores every new inner Observable if the previous Observable has\n * not yet completed. Once that one completes, it will accept and flatten the\n * next inner Observable and repeat this process.\n *\n * @example <caption>Run a finite timer for each click, only if there is no currently active timer</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));\n * var result = higherOrder.exhaust();\n * result.subscribe(x => console.log(x));\n *\n * @see {@link combineAll}\n * @see {@link concatAll}\n * @see {@link switch}\n * @see {@link mergeAll}\n * @see {@link exhaustMap}\n * @see {@link zipAll}\n *\n * @return {Observable} Returns an Observable that takes a source of Observables\n * and propagates the first observable exclusively until it completes before\n * subscribing to the next.\n * @method exhaust\n * @owner Observable\n ", "range": [ 117, 1720 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 38, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 1721, 1799 ], "loc": { "start": { "line": 39, "column": 0 }, "end": { "line": 41, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Converts a higher-order Observable into a first-order Observable by dropping\n * inner Observables while the previous inner Observable has not yet completed.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables by dropping the\n * next inner Observables while the current inner is still executing.</span>\n *\n * <img src=\"./img/exhaust.png\" width=\"100%\">\n *\n * `exhaust` subscribes to an Observable that emits Observables, also known as a\n * higher-order Observable. Each time it observes one of these emitted inner\n * Observables, the output Observable begins emitting the items emitted by that\n * inner Observable. So far, it behaves like {@link mergeAll}. However,\n * `exhaust` ignores every new inner Observable if the previous Observable has\n * not yet completed. Once that one completes, it will accept and flatten the\n * next inner Observable and repeat this process.\n *\n * @example <caption>Run a finite timer for each click, only if there is no currently active timer</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));\n * var result = higherOrder.exhaust();\n * result.subscribe(x => console.log(x));\n *\n * @see {@link combineAll}\n * @see {@link concatAll}\n * @see {@link switch}\n * @see {@link mergeAll}\n * @see {@link exhaustMap}\n * @see {@link zipAll}\n *\n * @return {Observable} Returns an Observable that takes a source of Observables\n * and propagates the first observable exclusively until it completes before\n * subscribing to the next.\n * @method exhaust\n * @owner Observable\n ", "range": [ 117, 1720 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 38, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "SwitchFirstOperator", "range": [ 1804, 1823 ], "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 42, "column": 23 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "SwitchFirstOperator", "range": [ 1854, 1873 ], "loc": { "start": { "line": 43, "column": 13 }, "end": { "line": 43, "column": 32 } } }, "params": [], "body": { "type": "BlockStatement", "body": [], "range": [ 1876, 1883 ], "loc": { "start": { "line": 43, "column": 35 }, "end": { "line": 44, "column": 5 } } }, "generator": false, "expression": false, "range": [ 1845, 1883 ], "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 44, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "SwitchFirstOperator", "range": [ 1888, 1907 ], "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 23 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 1908, 1917 ], "loc": { "start": { "line": 45, "column": 24 }, "end": { "line": 45, "column": 33 } } }, "range": [ 1888, 1917 ], "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 33 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 1918, 1922 ], "loc": { "start": { "line": 45, "column": 34 }, "end": { "line": 45, "column": 38 } } }, "range": [ 1888, 1922 ], "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 38 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "subscriber", "range": [ 1935, 1945 ], "loc": { "start": { "line": 45, "column": 51 }, "end": { "line": 45, "column": 61 } } }, { "type": "Identifier", "name": "source", "range": [ 1947, 1953 ], "loc": { "start": { "line": 45, "column": 63 }, "end": { "line": 45, "column": 69 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "source", "range": [ 1972, 1978 ], "loc": { "start": { "line": 46, "column": 15 }, "end": { "line": 46, "column": 21 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 1979, 1989 ], "loc": { "start": { "line": 46, "column": 22 }, "end": { "line": 46, "column": 32 } } }, "range": [ 1972, 1989 ], "loc": { "start": { "line": 46, "column": 15 }, "end": { "line": 46, "column": 32 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "SwitchFirstSubscriber", "range": [ 1994, 2015 ], "loc": { "start": { "line": 46, "column": 37 }, "end": { "line": 46, "column": 58 } } }, "arguments": [ { "type": "Identifier", "name": "subscriber", "range": [ 2016, 2026 ], "loc": { "start": { "line": 46, "column": 59 }, "end": { "line": 46, "column": 69 } } } ], "range": [ 1990, 2027 ], "loc": { "start": { "line": 46, "column": 33 }, "end": { "line": 46, "column": 70 } } } ], "range": [ 1972, 2028 ], "loc": { "start": { "line": 46, "column": 15 }, "end": { "line": 46, "column": 71 } } }, "range": [ 1965, 2029 ], "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 72 } } } ], "range": [ 1955, 2035 ], "loc": { "start": { "line": 45, "column": 71 }, "end": { "line": 47, "column": 5 } } }, "generator": false, "expression": false, "range": [ 1925, 2035 ], "loc": { "start": { "line": 45, "column": 41 }, "end": { "line": 47, "column": 5 } } }, "range": [ 1888, 2035 ], "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 47, "column": 5 } } }, "range": [ 1888, 2036 ], "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 47, "column": 6 } } }, { "type": "ReturnStatement", "argument": { "type": "Identifier", "name": "SwitchFirstOperator", "range": [ 2048, 2067 ], "loc": { "start": { "line": 48, "column": 11 }, "end": { "line": 48, "column": 30 } } }, "range": [ 2041, 2068 ], "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 48, "column": 31 } } } ], "range": [ 1839, 2070 ], "loc": { "start": { "line": 42, "column": 39 }, "end": { "line": 49, "column": 1 } } }, "generator": false, "expression": false, "range": [ 1827, 2070 ], "loc": { "start": { "line": 42, "column": 27 }, "end": { "line": 49, "column": 1 } } }, "arguments": [], "range": [ 1827, 2072 ], "loc": { "start": { "line": 42, "column": 27 }, "end": { "line": 49, "column": 3 } } }, "range": [ 1804, 2073 ], "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 49, "column": 4 } } } ], "kind": "var", "range": [ 1800, 2074 ], "loc": { "start": { "line": 42, "column": 0 }, "end": { "line": 49, "column": 5 } }, "trailingComments": [ { "type": "Block", "value": "*\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n ", "range": [ 2075, 2166 ], "loc": { "start": { "line": 50, "column": 0 }, "end": { "line": 54, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "SwitchFirstSubscriber", "range": [ 2171, 2192 ], "loc": { "start": { "line": 55, "column": 4 }, "end": { "line": 55, "column": 25 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "_super", "range": [ 2206, 2212 ], "loc": { "start": { "line": 55, "column": 39 }, "end": { "line": 55, "column": 45 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "Identifier", "name": "__extends", "range": [ 2220, 2229 ], "loc": { "start": { "line": 56, "column": 4 }, "end": { "line": 56, "column": 13 } } }, "arguments": [ { "type": "Identifier", "name": "SwitchFirstSubscriber", "range": [ 2230, 2251 ], "loc": { "start": { "line": 56, "column": 14 }, "end": { "line": 56, "column": 35 } } }, { "type": "Identifier", "name": "_super", "range": [ 2253, 2259 ], "loc": { "start": { "line": 56, "column": 37 }, "end": { "line": 56, "column": 43 } } } ], "range": [ 2220, 2260 ], "loc": { "start": { "line": 56, "column": 4 }, "end": { "line": 56, "column": 44 } } }, "range": [ 2220, 2261 ], "loc": { "start": { "line": 56, "column": 4 }, "end": { "line": 56, "column": 45 } } }, { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "SwitchFirstSubscriber", "range": [ 2275, 2296 ], "loc": { "start": { "line": 57, "column": 13 }, "end": { "line": 57, "column": 34 } } }, "params": [ { "type": "Identifier", "name": "destination", "range": [ 2297, 2308 ], "loc": { "start": { "line": 57, "column": 35 }, "end": { "line": 57, "column": 46 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "_super", "range": [ 2320, 2326 ], "loc": { "start": { "line": 58, "column": 8 }, "end": { "line": 58, "column": 14 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 2327, 2331 ], "loc": { "start": { "line": 58, "column": 15 }, "end": { "line": 58, "column": 19 } } }, "range": [ 2320, 2331 ], "loc": { "start": { "line": 58, "column": 8 }, "end": { "line": 58, "column": 19 } } }, "arguments": [ { "type": "ThisExpression", "range": [ 2332, 2336 ], "loc": { "start": { "line": 58, "column": 20 }, "end": { "line": 58, "column": 24 } } }, { "type": "Identifier", "name": "destination", "range": [ 2338, 2349 ], "loc": { "start": { "line": 58, "column": 26 }, "end": { "line": 58, "column": 37 } } } ], "range": [ 2320, 2350 ], "loc": { "start": { "line": 58, "column": 8 }, "end": { "line": 58, "column": 38 } } }, "range": [ 2320, 2351 ], "loc": { "start": { "line": 58, "column": 8 }, "end": { "line": 58, "column": 39 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2360, 2364 ], "loc": { "start": { "line": 59, "column": 8 }, "end": { "line": 59, "column": 12 } } }, "property": { "type": "Identifier", "name": "hasCompleted", "range": [ 2365, 2377 ], "loc": { "start": { "line": 59, "column": 13 }, "end": { "line": 59, "column": 25 } } }, "range": [ 2360, 2377 ], "loc": { "start": { "line": 59, "column": 8 }, "end": { "line": 59, "column": 25 } } }, "right": { "type": "Literal", "value": false, "raw": "false", "range": [ 2380, 2385 ], "loc": { "start": { "line": 59, "column": 28 }, "end": { "line": 59, "column": 33 } } }, "range": [ 2360, 2385 ], "loc": { "start": { "line": 59, "column": 8 }, "end": { "line": 59, "column": 33 } } }, "range": [ 2360, 2386 ], "loc": { "start": { "line": 59, "column": 8 }, "end": { "line": 59, "column": 34 } } }, { "typ