UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,468 lines (1,467 loc) 111 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 * Buffers the source Observable values until `closingNotifier` emits.\n *\n * <span class=\"informal\">Collects values from the past as an array, and emits\n * that array only when another Observable emits.</span>\n *\n * <img src=\"./img/buffer.png\" width=\"100%\">\n *\n * Buffers the incoming Observable values until the given `closingNotifier`\n * Observable emits a value, at which point it emits the buffer on the output\n * Observable and starts a new buffer internally, awaiting the next time\n * `closingNotifier` emits.\n *\n * @example <caption>On every click, emit array of most recent interval events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var interval = Rx.Observable.interval(1000);\n * var buffered = interval.buffer(clicks);\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link bufferWhen}\n * @see {@link window}\n *\n * @param {Observable<any>} closingNotifier An Observable that signals the\n * buffer to be emitted on the output Observable.\n * @return {Observable<T[]>} An Observable of buffers, which are arrays of\n * values.\n * @method buffer\n * @owner Observable\n ", "range": [ 117, 1317 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 34, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "buffer", "range": [ 1334, 1340 ], "loc": { "start": { "line": 35, "column": 16 }, "end": { "line": 35, "column": 22 } } }, "params": [ { "type": "Identifier", "name": "closingNotifier", "range": [ 1341, 1356 ], "loc": { "start": { "line": 35, "column": 23 }, "end": { "line": 35, "column": 38 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1371, 1375 ], "loc": { "start": { "line": 36, "column": 11 }, "end": { "line": 36, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 1376, 1380 ], "loc": { "start": { "line": 36, "column": 16 }, "end": { "line": 36, "column": 20 } } }, "range": [ 1371, 1380 ], "loc": { "start": { "line": 36, "column": 11 }, "end": { "line": 36, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "BufferOperator", "range": [ 1385, 1399 ], "loc": { "start": { "line": 36, "column": 25 }, "end": { "line": 36, "column": 39 } } }, "arguments": [ { "type": "Identifier", "name": "closingNotifier", "range": [ 1400, 1415 ], "loc": { "start": { "line": 36, "column": 40 }, "end": { "line": 36, "column": 55 } } } ], "range": [ 1381, 1416 ], "loc": { "start": { "line": 36, "column": 21 }, "end": { "line": 36, "column": 56 } } } ], "range": [ 1371, 1417 ], "loc": { "start": { "line": 36, "column": 11 }, "end": { "line": 36, "column": 57 } } }, "range": [ 1364, 1418 ], "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 36, "column": 58 } } } ], "range": [ 1358, 1420 ], "loc": { "start": { "line": 35, "column": 40 }, "end": { "line": 37, "column": 1 } } }, "generator": false, "expression": false, "range": [ 1325, 1420 ], "loc": { "start": { "line": 35, "column": 7 }, "end": { "line": 37, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Buffers the source Observable values until `closingNotifier` emits.\n *\n * <span class=\"informal\">Collects values from the past as an array, and emits\n * that array only when another Observable emits.</span>\n *\n * <img src=\"./img/buffer.png\" width=\"100%\">\n *\n * Buffers the incoming Observable values until the given `closingNotifier`\n * Observable emits a value, at which point it emits the buffer on the output\n * Observable and starts a new buffer internally, awaiting the next time\n * `closingNotifier` emits.\n *\n * @example <caption>On every click, emit array of most recent interval events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var interval = Rx.Observable.interval(1000);\n * var buffered = interval.buffer(clicks);\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link bufferWhen}\n * @see {@link window}\n *\n * @param {Observable<any>} closingNotifier An Observable that signals the\n * buffer to be emitted on the output Observable.\n * @return {Observable<T[]>} An Observable of buffers, which are arrays of\n * values.\n * @method buffer\n * @owner Observable\n ", "range": [ 117, 1317 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 34, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 1318, 1420 ], "loc": { "start": { "line": 35, "column": 0 }, "end": { "line": 37, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Buffers the source Observable values until `closingNotifier` emits.\n *\n * <span class=\"informal\">Collects values from the past as an array, and emits\n * that array only when another Observable emits.</span>\n *\n * <img src=\"./img/buffer.png\" width=\"100%\">\n *\n * Buffers the incoming Observable values until the given `closingNotifier`\n * Observable emits a value, at which point it emits the buffer on the output\n * Observable and starts a new buffer internally, awaiting the next time\n * `closingNotifier` emits.\n *\n * @example <caption>On every click, emit array of most recent interval events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var interval = Rx.Observable.interval(1000);\n * var buffered = interval.buffer(clicks);\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link bufferWhen}\n * @see {@link window}\n *\n * @param {Observable<any>} closingNotifier An Observable that signals the\n * buffer to be emitted on the output Observable.\n * @return {Observable<T[]>} An Observable of buffers, which are arrays of\n * values.\n * @method buffer\n * @owner Observable\n ", "range": [ 117, 1317 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 34, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "BufferOperator", "range": [ 1425, 1439 ], "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 38, "column": 18 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "BufferOperator", "range": [ 1470, 1484 ], "loc": { "start": { "line": 39, "column": 13 }, "end": { "line": 39, "column": 27 } } }, "params": [ { "type": "Identifier", "name": "closingNotifier", "range": [ 1485, 1500 ], "loc": { "start": { "line": 39, "column": 28 }, "end": { "line": 39, "column": 43 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1512, 1516 ], "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 12 } } }, "property": { "type": "Identifier", "name": "closingNotifier", "range": [ 1517, 1532 ], "loc": { "start": { "line": 40, "column": 13 }, "end": { "line": 40, "column": 28 } } }, "range": [ 1512, 1532 ], "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 28 } } }, "right": { "type": "Identifier", "name": "closingNotifier", "range": [ 1535, 1550 ], "loc": { "start": { "line": 40, "column": 31 }, "end": { "line": 40, "column": 46 } } }, "range": [ 1512, 1550 ], "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 46 } } }, "range": [ 1512, 1551 ], "loc": { "start": { "line": 40, "column": 8 }, "end": { "line": 40, "column": 47 } } } ], "range": [ 1502, 1557 ], "loc": { "start": { "line": 39, "column": 45 }, "end": { "line": 41, "column": 5 } } }, "generator": false, "expression": false, "range": [ 1461, 1557 ], "loc": { "start": { "line": 39, "column": 4 }, "end": { "line": 41, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "BufferOperator", "range": [ 1562, 1576 ], "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 42, "column": 18 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 1577, 1586 ], "loc": { "start": { "line": 42, "column": 19 }, "end": { "line": 42, "column": 28 } } }, "range": [ 1562, 1586 ], "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 42, "column": 28 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 1587, 1591 ], "loc": { "start": { "line": 42, "column": 29 }, "end": { "line": 42, "column": 33 } } }, "range": [ 1562, 1591 ], "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 42, "column": 33 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "subscriber", "range": [ 1604, 1614 ], "loc": { "start": { "line": 42, "column": 46 }, "end": { "line": 42, "column": 56 } } }, { "type": "Identifier", "name": "source", "range": [ 1616, 1622 ], "loc": { "start": { "line": 42, "column": 58 }, "end": { "line": 42, "column": 64 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "source", "range": [ 1641, 1647 ], "loc": { "start": { "line": 43, "column": 15 }, "end": { "line": 43, "column": 21 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 1648, 1658 ], "loc": { "start": { "line": 43, "column": 22 }, "end": { "line": 43, "column": 32 } } }, "range": [ 1641, 1658 ], "loc": { "start": { "line": 43, "column": 15 }, "end": { "line": 43, "column": 32 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "BufferSubscriber", "range": [ 1663, 1679 ], "loc": { "start": { "line": 43, "column": 37 }, "end": { "line": 43, "column": 53 } } }, "arguments": [ { "type": "Identifier", "name": "subscriber", "range": [ 1680, 1690 ], "loc": { "start": { "line": 43, "column": 54 }, "end": { "line": 43, "column": 64 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1692, 1696 ], "loc": { "start": { "line": 43, "column": 66 }, "end": { "line": 43, "column": 70 } } }, "property": { "type": "Identifier", "name": "closingNotifier", "range": [ 1697, 1712 ], "loc": { "start": { "line": 43, "column": 71 }, "end": { "line": 43, "column": 86 } } }, "range": [ 1692, 1712 ], "loc": { "start": { "line": 43, "column": 66 }, "end": { "line": 43, "column": 86 } } } ], "range": [ 1659, 1713 ], "loc": { "start": { "line": 43, "column": 33 }, "end": { "line": 43, "column": 87 } } } ], "range": [ 1641, 1714 ], "loc": { "start": { "line": 43, "column": 15 }, "end": { "line": 43, "column": 88 } } }, "range": [ 1634, 1715 ], "loc": { "start": { "line": 43, "column": 8 }, "end": { "line": 43, "column": 89 } } } ], "range": [ 1624, 1721 ], "loc": { "start": { "line": 42, "column": 66 }, "end": { "line": 44, "column": 5 } } }, "generator": false, "expression": false, "range": [ 1594, 1721 ], "loc": { "start": { "line": 42, "column": 36 }, "end": { "line": 44, "column": 5 } } }, "range": [ 1562, 1721 ], "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 44, "column": 5 } } }, "range": [ 1562, 1722 ], "loc": { "start": { "line": 42, "column": 4 }, "end": { "line": 44, "column": 6 } } }, { "type": "ReturnStatement", "argument": { "type": "Identifier", "name": "BufferOperator", "range": [ 1734, 1748 ], "loc": { "start": { "line": 45, "column": 11 }, "end": { "line": 45, "column": 25 } } }, "range": [ 1727, 1749 ], "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 26 } } } ], "range": [ 1455, 1751 ], "loc": { "start": { "line": 38, "column": 34 }, "end": { "line": 46, "column": 1 } } }, "generator": false, "expression": false, "range": [ 1443, 1751 ], "loc": { "start": { "line": 38, "column": 22 }, "end": { "line": 46, "column": 1 } } }, "arguments": [], "range": [ 1443, 1753 ], "loc": { "start": { "line": 38, "column": 22 }, "end": { "line": 46, "column": 3 } } }, "range": [ 1425, 1754 ], "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 46, "column": 4 } } } ], "kind": "var", "range": [ 1421, 1755 ], "loc": { "start": { "line": 38, "column": 0 }, "end": { "line": 46, "column": 5 } }, "trailingComments": [ { "type": "Block", "value": "*\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n ", "range": [ 1756, 1847 ], "loc": { "start": { "line": 47, "column": 0 }, "end": { "line": 51, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "BufferSubscriber", "range": [ 1852, 1868 ], "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 52, "column": 20 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "_super", "range": [ 1882, 1888 ], "loc": { "start": { "line": 52, "column": 34 }, "end": { "line": 52, "column": 40 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "Identifier", "name": "__extends", "range": [ 1896, 1905 ], "loc": { "start": { "line": 53, "column": 4 }, "end": { "line": 53, "column": 13 } } }, "arguments": [ { "type": "Identifier", "name": "BufferSubscriber", "range": [ 1906, 1922 ], "loc": { "start": { "line": 53, "column": 14 }, "end": { "line": 53, "column": 30 } } }, { "type": "Identifier", "name": "_super", "range": [ 1924, 1930 ], "loc": { "start": { "line": 53, "column": 32 }, "end": { "line": 53, "column": 38 } } } ], "range": [ 1896, 1931 ], "loc": { "start": { "line": 53, "column": 4 }, "end": { "line": 53, "column": 39 } } }, "range": [ 1896, 1932 ], "loc": { "start": { "line": 53, "column": 4 }, "end": { "line": 53, "column": 40 } } }, { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "BufferSubscriber", "range": [ 1946, 1962 ], "loc": { "start": { "line": 54, "column": 13 }, "end": { "line": 54, "column": 29 } } }, "params": [ { "type": "Identifier", "name": "destination", "range": [ 1963, 1974 ], "loc": { "start": { "line": 54, "column": 30 }, "end": { "line": 54, "column": 41 } } }, { "type": "Identifier", "name": "closingNotifier", "range": [ 1976, 1991 ], "loc": { "start": { "line": 54, "column": 43 }, "end": { "line": 54, "column": 58 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "_super", "range": [ 2003, 2009 ], "loc": { "start": { "line": 55, "column": 8 }, "end": { "line": 55, "column": 14 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 2010,