UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,338 lines (1,337 loc) 214 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 which\n * concurrently delivers all values that are emitted on the inner Observables.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables.</span>\n *\n * <img src=\"./img/mergeAll.png\" width=\"100%\">\n *\n * `mergeAll` subscribes to an Observable that emits Observables, also known as\n * a higher-order Observable. Each time it observes one of these emitted inner\n * Observables, it subscribes to that and delivers all the values from the\n * inner Observable on the output Observable. The output Observable only\n * completes once all inner Observables have completed. Any error delivered by\n * a inner Observable will be immediately emitted on the output Observable.\n *\n * @example <caption>Spawn a new interval Observable for each click event, and blend their outputs as one Observable</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));\n * var firstOrder = higherOrder.mergeAll();\n * firstOrder.subscribe(x => console.log(x));\n *\n * @example <caption>Count from 0 to 9 every second for each click, but only allow 2 concurrent timers</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10));\n * var firstOrder = higherOrder.mergeAll(2);\n * firstOrder.subscribe(x => console.log(x));\n *\n * @see {@link combineAll}\n * @see {@link concatAll}\n * @see {@link exhaust}\n * @see {@link merge}\n * @see {@link mergeMap}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n * @see {@link switch}\n * @see {@link zipAll}\n *\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner\n * Observables being subscribed to concurrently.\n * @return {Observable} An Observable that emits values coming from all the\n * inner Observables emitted by the source Observable.\n * @method mergeAll\n * @owner Observable\n ", "range": [ 117, 2096 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 46, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "mergeAll", "range": [ 2113, 2121 ], "loc": { "start": { "line": 47, "column": 16 }, "end": { "line": 47, "column": 24 } } }, "params": [ { "type": "Identifier", "name": "concurrent", "range": [ 2122, 2132 ], "loc": { "start": { "line": 47, "column": 25 }, "end": { "line": 47, "column": 35 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "IfStatement", "test": { "type": "BinaryExpression", "operator": "===", "left": { "type": "Identifier", "name": "concurrent", "range": [ 2144, 2154 ], "loc": { "start": { "line": 48, "column": 8 }, "end": { "line": 48, "column": 18 } } }, "right": { "type": "UnaryExpression", "operator": "void", "argument": { "type": "Literal", "value": 0, "raw": "0", "range": [ 2164, 2165 ], "loc": { "start": { "line": 48, "column": 28 }, "end": { "line": 48, "column": 29 } } }, "prefix": true, "range": [ 2159, 2165 ], "loc": { "start": { "line": 48, "column": 23 }, "end": { "line": 48, "column": 29 } } }, "range": [ 2144, 2165 ], "loc": { "start": { "line": 48, "column": 8 }, "end": { "line": 48, "column": 29 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "Identifier", "name": "concurrent", "range": [ 2169, 2179 ], "loc": { "start": { "line": 48, "column": 33 }, "end": { "line": 48, "column": 43 } } }, "right": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "Number", "range": [ 2182, 2188 ], "loc": { "start": { "line": 48, "column": 46 }, "end": { "line": 48, "column": 52 } } }, "property": { "type": "Identifier", "name": "POSITIVE_INFINITY", "range": [ 2189, 2206 ], "loc": { "start": { "line": 48, "column": 53 }, "end": { "line": 48, "column": 70 } } }, "range": [ 2182, 2206 ], "loc": { "start": { "line": 48, "column": 46 }, "end": { "line": 48, "column": 70 } } }, "range": [ 2169, 2206 ], "loc": { "start": { "line": 48, "column": 33 }, "end": { "line": 48, "column": 70 } } }, "range": [ 2169, 2207 ], "loc": { "start": { "line": 48, "column": 33 }, "end": { "line": 48, "column": 71 } } } ], "range": [ 2167, 2209 ], "loc": { "start": { "line": 48, "column": 31 }, "end": { "line": 48, "column": 73 } } }, "alternate": null, "range": [ 2140, 2209 ], "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 48, "column": 73 } } }, { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2221, 2225 ], "loc": { "start": { "line": 49, "column": 11 }, "end": { "line": 49, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 2226, 2230 ], "loc": { "start": { "line": 49, "column": 16 }, "end": { "line": 49, "column": 20 } } }, "range": [ 2221, 2230 ], "loc": { "start": { "line": 49, "column": 11 }, "end": { "line": 49, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "MergeAllOperator", "range": [ 2235, 2251 ], "loc": { "start": { "line": 49, "column": 25 }, "end": { "line": 49, "column": 41 } } }, "arguments": [ { "type": "Identifier", "name": "concurrent", "range": [ 2252, 2262 ], "loc": { "start": { "line": 49, "column": 42 }, "end": { "line": 49, "column": 52 } } } ], "range": [ 2231, 2263 ], "loc": { "start": { "line": 49, "column": 21 }, "end": { "line": 49, "column": 53 } } } ], "range": [ 2221, 2264 ], "loc": { "start": { "line": 49, "column": 11 }, "end": { "line": 49, "column": 54 } } }, "range": [ 2214, 2265 ], "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "column": 55 } } } ], "range": [ 2134, 2267 ], "loc": { "start": { "line": 47, "column": 37 }, "end": { "line": 50, "column": 1 } } }, "generator": false, "expression": false, "range": [ 2104, 2267 ], "loc": { "start": { "line": 47, "column": 7 }, "end": { "line": 50, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Converts a higher-order Observable into a first-order Observable which\n * concurrently delivers all values that are emitted on the inner Observables.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables.</span>\n *\n * <img src=\"./img/mergeAll.png\" width=\"100%\">\n *\n * `mergeAll` subscribes to an Observable that emits Observables, also known as\n * a higher-order Observable. Each time it observes one of these emitted inner\n * Observables, it subscribes to that and delivers all the values from the\n * inner Observable on the output Observable. The output Observable only\n * completes once all inner Observables have completed. Any error delivered by\n * a inner Observable will be immediately emitted on the output Observable.\n *\n * @example <caption>Spawn a new interval Observable for each click event, and blend their outputs as one Observable</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));\n * var firstOrder = higherOrder.mergeAll();\n * firstOrder.subscribe(x => console.log(x));\n *\n * @example <caption>Count from 0 to 9 every second for each click, but only allow 2 concurrent timers</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10));\n * var firstOrder = higherOrder.mergeAll(2);\n * firstOrder.subscribe(x => console.log(x));\n *\n * @see {@link combineAll}\n * @see {@link concatAll}\n * @see {@link exhaust}\n * @see {@link merge}\n * @see {@link mergeMap}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n * @see {@link switch}\n * @see {@link zipAll}\n *\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner\n * Observables being subscribed to concurrently.\n * @return {Observable} An Observable that emits values coming from all the\n * inner Observables emitted by the source Observable.\n * @method mergeAll\n * @owner Observable\n ", "range": [ 117, 2096 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 46, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 2097, 2267 ], "loc": { "start": { "line": 47, "column": 0 }, "end": { "line": 50, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Converts a higher-order Observable into a first-order Observable which\n * concurrently delivers all values that are emitted on the inner Observables.\n *\n * <span class=\"informal\">Flattens an Observable-of-Observables.</span>\n *\n * <img src=\"./img/mergeAll.png\" width=\"100%\">\n *\n * `mergeAll` subscribes to an Observable that emits Observables, also known as\n * a higher-order Observable. Each time it observes one of these emitted inner\n * Observables, it subscribes to that and delivers all the values from the\n * inner Observable on the output Observable. The output Observable only\n * completes once all inner Observables have completed. Any error delivered by\n * a inner Observable will be immediately emitted on the output Observable.\n *\n * @example <caption>Spawn a new interval Observable for each click event, and blend their outputs as one Observable</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));\n * var firstOrder = higherOrder.mergeAll();\n * firstOrder.subscribe(x => console.log(x));\n *\n * @example <caption>Count from 0 to 9 every second for each click, but only allow 2 concurrent timers</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10));\n * var firstOrder = higherOrder.mergeAll(2);\n * firstOrder.subscribe(x => console.log(x));\n *\n * @see {@link combineAll}\n * @see {@link concatAll}\n * @see {@link exhaust}\n * @see {@link merge}\n * @see {@link mergeMap}\n * @see {@link mergeMapTo}\n * @see {@link mergeScan}\n * @see {@link switch}\n * @see {@link zipAll}\n *\n * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner\n * Observables being subscribed to concurrently.\n * @return {Observable} An Observable that emits values coming from all the\n * inner Observables emitted by the source Observable.\n * @method mergeAll\n * @owner Observable\n ", "range": [ 117, 2096 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 46, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "MergeAllOperator", "range": [ 2279, 2295 ], "loc": { "start": { "line": 51, "column": 11 }, "end": { "line": 51, "column": 27 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "MergeAllOperator", "range": [ 2326, 2342 ], "loc": { "start": { "line": 52, "column": 13 }, "end": { "line": 52, "column": 29 } } }, "params": [ { "type": "Identifier", "name": "concurrent", "range": [ 2343, 2353 ], "loc": { "start": { "line": 52, "column": 30 }, "end": { "line": 52, "column": 40 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2365, 2369 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 12 } } }, "property": { "type": "Identifier", "name": "concurrent", "range": [ 2370, 2380 ], "loc": { "start": { "line": 53, "column": 13 }, "end": { "line": 53, "column": 23 } } }, "range": [ 2365, 2380 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 23 } } }, "right": { "type": "Identifier", "name": "concurrent", "range": [ 2383, 2393 ], "loc": { "start": { "line": 53, "column": 26 }, "end": { "line": 53, "column": 36 } } }, "range": [ 2365, 2393 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 36 } } }, "range": [ 2365, 2394 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 37 } } } ], "range": [ 2355, 2400 ], "loc": { "start": { "line": 52, "column": 42 }, "end": { "line": 54, "column": 5 } } }, "generator": false, "expression": false, "range": [ 2317, 2400 ], "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 54, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "MergeAllOperator", "range": [ 2405, 2421 ], "loc": { "start": { "line": 55, "column": 4 }, "end": { "line": 55, "column": 20 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 2422, 2431 ], "loc": { "start": { "line": 55, "column": 21 }, "end": { "line": 55, "column": 30 } } }, "range": [ 2405, 2431 ], "loc": { "start": { "line": 55, "column": 4 }, "end": { "line": 55, "column": 30 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 2432, 2436 ], "loc": { "start": { "line": 55, "column": 31 }, "end": { "line": 55, "column": 35 } } }, "range": [ 2405, 2436 ], "loc": { "start": { "line": 55, "column": 4 }, "end": { "line": 55, "column": 35 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "observer", "range": [ 2449, 2457 ], "loc": { "start": { "line": 55, "column": 48 }, "end": { "line": 55, "column": 56 } } }, { "type": "Identifier", "name": "source", "range": [ 2459, 2465 ], "loc": { "start": { "line": 55, "column": 58 }, "end": { "line": 55, "column": 64 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "source", "range": [ 2484, 2490 ], "loc": { "start": { "line": 56, "column": 15 }, "end": { "line": 56, "column": 21 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 2491, 2501 ], "loc": { "start": { "line": 56, "column": 22 }, "end": { "line": 56, "column": 32 } } }, "range": [ 2484, 2501 ], "loc": { "start": { "line": 56, "column": 15 }, "end": { "line": 56, "column": 32 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "MergeAllSubscriber", "range": [ 2506, 2524 ], "loc": { "start": { "line": 56, "column": 37 }, "end": { "line": 56, "column": 55 } } }, "arguments": [ { "type": "Identifier", "name": "observer", "range": [ 2525, 2533 ], "loc": { "start": { "line": 56, "column": 56 }, "end": { "line": 56, "column": 64 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2535, 2539 ], "loc": { "start": { "line": 56, "column": 66 }, "end": { "line": 56, "column": 70 } } }, "property": { "type": "Identifier", "name": "concurrent", "range": [ 2540, 2550 ], "loc": { "start": { "line": 56, "column": 71 }, "end": { "line": 56, "column": 81 } } }, "range": [ 2535, 2550 ], "loc": { "start": { "line": 56, "column": 66 }, "end": { "line": 56, "column": 81 } } } ], "range": [ 2502, 2551 ], "loc": { "start": { "line": 56, "column": 33 }, "end": { "line": 56, "column": 82 } } } ], "range": [ 2484, 2552 ], "loc": { "start": { "line": 56, "column": 15 }, "end": { "line": 56, "column": 83 } } }, "range": [ 2477, 2553 ], "loc": { "start": { "line": 56, "column": 8 }, "end": { "line": 56, "column": 84 } } } ], "range": [ 2467, 2559 ], "loc": { "start": { "line": 55, "column": 66 }, "end": { "line": 57, "column": 5 } } }, "generator": false, "expression": false, "range": [ 2439, 2559 ], "loc": { "start": { "line": 55, "column": 38 }, "end": { "line": 57, "column": 5 } } }, "range": [ 2405, 2559 ], "loc": { "start": { "line": 55, "column": 4 }, "end": { "line": 57, "column": 5 } } }, "range": [ 2405, 2560 ], "loc": { "start": { "line": 55, "column": 4 }, "end": { "line": 57, "column": 6 } } }, { "type": "ReturnStatement", "argument": { "type": "Identifier", "name": "MergeAllOperator", "range": [ 2572, 2588 ], "loc": { "start": { "line": 58, "column": 11 }, "end": { "line": 58, "column": 27 }