UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,345 lines 225 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "Subject", "range": [ 9, 16 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 16 } } }, "imported": { "type": "Identifier", "name": "Subject", "range": [ 9, 16 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 16 } } }, "range": [ 9, 16 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 16 } } } ], "source": { "type": "Literal", "value": "../Subject", "raw": "'../Subject'", "range": [ 24, 36 ], "loc": { "start": { "line": 1, "column": 24 }, "end": { "line": 1, "column": 36 } } }, "range": [ 0, 37 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 37 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "OuterSubscriber", "range": [ 47, 62 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 24 } } }, "imported": { "type": "Identifier", "name": "OuterSubscriber", "range": [ 47, 62 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 24 } } }, "range": [ 47, 62 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 24 } } } ], "source": { "type": "Literal", "value": "../OuterSubscriber", "raw": "'../OuterSubscriber'", "range": [ 70, 90 ], "loc": { "start": { "line": 2, "column": 32 }, "end": { "line": 2, "column": 52 } } }, "range": [ 38, 91 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 53 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "subscribeToResult", "range": [ 101, 118 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 26 } } }, "imported": { "type": "Identifier", "name": "subscribeToResult", "range": [ 101, 118 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 26 } } }, "range": [ 101, 118 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 26 } } } ], "source": { "type": "Literal", "value": "../util/subscribeToResult", "raw": "'../util/subscribeToResult'", "range": [ 126, 153 ], "loc": { "start": { "line": 3, "column": 34 }, "end": { "line": 3, "column": 61 } } }, "range": [ 92, 154 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 62 } }, "trailingComments": [ { "type": "Block", "value": "*\n * Branch out the source Observable values as a nested Observable whenever\n * `windowBoundaries` emits.\n *\n * <span class=\"informal\">It's like {@link buffer}, but emits a nested Observable\n * instead of an array.</span>\n *\n * <img src=\"./img/window.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits connected, non-overlapping\n * windows. It emits the current window and opens a new one whenever the\n * Observable `windowBoundaries` emits an item. Because each window is an\n * Observable, the output is a higher-order Observable.\n *\n * @example <caption>In every window of 1 second each, emit at most 2 click events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var interval = Rx.Observable.interval(1000);\n * var result = clicks.window(interval)\n * .map(win => win.take(2)) // each window has at most 2 emissions\n * .mergeAll(); // flatten the Observable-of-Observables\n * result.subscribe(x => console.log(x));\n *\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowToggle}\n * @see {@link windowWhen}\n * @see {@link buffer}\n *\n * @param {Observable<any>} windowBoundaries An Observable that completes the\n * previous window and starts a new window.\n * @return {Observable<Observable<T>>} An Observable of windows, which are\n * Observables emitting values of the source Observable.\n * @method window\n * @owner Observable\n ", "range": [ 155, 1634 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 39, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "window", "range": [ 1651, 1657 ], "loc": { "start": { "line": 40, "column": 16 }, "end": { "line": 40, "column": 22 } } }, "params": [ { "type": "Identifier", "name": "windowBoundaries", "range": [ 1658, 1674 ], "loc": { "start": { "line": 40, "column": 23 }, "end": { "line": 40, "column": 39 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1689, 1693 ], "loc": { "start": { "line": 41, "column": 11 }, "end": { "line": 41, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 1694, 1698 ], "loc": { "start": { "line": 41, "column": 16 }, "end": { "line": 41, "column": 20 } } }, "range": [ 1689, 1698 ], "loc": { "start": { "line": 41, "column": 11 }, "end": { "line": 41, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "WindowOperator", "range": [ 1703, 1717 ], "loc": { "start": { "line": 41, "column": 25 }, "end": { "line": 41, "column": 39 } } }, "arguments": [ { "type": "Identifier", "name": "windowBoundaries", "range": [ 1718, 1734 ], "loc": { "start": { "line": 41, "column": 40 }, "end": { "line": 41, "column": 56 } } } ], "range": [ 1699, 1735 ], "loc": { "start": { "line": 41, "column": 21 }, "end": { "line": 41, "column": 57 } } } ], "range": [ 1689, 1736 ], "loc": { "start": { "line": 41, "column": 11 }, "end": { "line": 41, "column": 58 } } }, "range": [ 1682, 1737 ], "loc": { "start": { "line": 41, "column": 4 }, "end": { "line": 41, "column": 59 } } } ], "range": [ 1676, 1739 ], "loc": { "start": { "line": 40, "column": 41 }, "end": { "line": 42, "column": 1 } } }, "generator": false, "expression": false, "range": [ 1642, 1739 ], "loc": { "start": { "line": 40, "column": 7 }, "end": { "line": 42, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Branch out the source Observable values as a nested Observable whenever\n * `windowBoundaries` emits.\n *\n * <span class=\"informal\">It's like {@link buffer}, but emits a nested Observable\n * instead of an array.</span>\n *\n * <img src=\"./img/window.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits connected, non-overlapping\n * windows. It emits the current window and opens a new one whenever the\n * Observable `windowBoundaries` emits an item. Because each window is an\n * Observable, the output is a higher-order Observable.\n *\n * @example <caption>In every window of 1 second each, emit at most 2 click events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var interval = Rx.Observable.interval(1000);\n * var result = clicks.window(interval)\n * .map(win => win.take(2)) // each window has at most 2 emissions\n * .mergeAll(); // flatten the Observable-of-Observables\n * result.subscribe(x => console.log(x));\n *\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowToggle}\n * @see {@link windowWhen}\n * @see {@link buffer}\n *\n * @param {Observable<any>} windowBoundaries An Observable that completes the\n * previous window and starts a new window.\n * @return {Observable<Observable<T>>} An Observable of windows, which are\n * Observables emitting values of the source Observable.\n * @method window\n * @owner Observable\n ", "range": [ 155, 1634 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 39, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 1635, 1739 ], "loc": { "start": { "line": 40, "column": 0 }, "end": { "line": 42, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Branch out the source Observable values as a nested Observable whenever\n * `windowBoundaries` emits.\n *\n * <span class=\"informal\">It's like {@link buffer}, but emits a nested Observable\n * instead of an array.</span>\n *\n * <img src=\"./img/window.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits connected, non-overlapping\n * windows. It emits the current window and opens a new one whenever the\n * Observable `windowBoundaries` emits an item. Because each window is an\n * Observable, the output is a higher-order Observable.\n *\n * @example <caption>In every window of 1 second each, emit at most 2 click events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var interval = Rx.Observable.interval(1000);\n * var result = clicks.window(interval)\n * .map(win => win.take(2)) // each window has at most 2 emissions\n * .mergeAll(); // flatten the Observable-of-Observables\n * result.subscribe(x => console.log(x));\n *\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowToggle}\n * @see {@link windowWhen}\n * @see {@link buffer}\n *\n * @param {Observable<any>} windowBoundaries An Observable that completes the\n * previous window and starts a new window.\n * @return {Observable<Observable<T>>} An Observable of windows, which are\n * Observables emitting values of the source Observable.\n * @method window\n * @owner Observable\n ", "range": [ 155, 1634 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 39, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "WindowOperator", "range": [ 1744, 1758 ], "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 43, "column": 18 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "WindowOperator", "range": [ 1789, 1803 ], "loc": { "start": { "line": 44, "column": 13 }, "end": { "line": 44, "column": 27 } } }, "params": [ { "type": "Identifier", "name": "windowBoundaries", "range": [ 1804, 1820 ], "loc": { "start": { "line": 44, "column": 28 }, "end": { "line": 44, "column": 44 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1832, 1836 ], "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 12 } } }, "property": { "type": "Identifier", "name": "windowBoundaries", "range": [ 1837, 1853 ], "loc": { "start": { "line": 45, "column": 13 }, "end": { "line": 45, "column": 29 } } }, "range": [ 1832, 1853 ], "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 29 } } }, "right": { "type": "Identifier", "name": "windowBoundaries", "range": [ 1856, 1872 ], "loc": { "start": { "line": 45, "column": 32 }, "end": { "line": 45, "column": 48 } } }, "range": [ 1832, 1872 ], "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 48 } } }, "range": [ 1832, 1873 ], "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 49 } } } ], "range": [ 1822, 1879 ], "loc": { "start": { "line": 44, "column": 46 }, "end": { "line": 46, "column": 5 } } }, "generator": false, "expression": false, "range": [ 1780, 1879 ], "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 46, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "WindowOperator", "range": [ 1884, 1898 ], "loc": { "start": { "line": 47, "column": 4 }, "end": { "line": 47, "column": 18 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 1899, 1908 ], "loc": { "start": { "line": 47, "column": 19 }, "end": { "line": 47, "column": 28 } } }, "range": [ 1884, 1908 ], "loc": { "start": { "line": 47, "column": 4 }, "end": { "line": 47, "column": 28 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 1909, 1913 ], "loc": { "start": { "line": 47, "column": 29 }, "end": { "line": 47, "column": 33 } } }, "range": [ 1884, 1913 ], "loc": { "start": { "line": 47, "column": 4 }, "end": { "line": 47, "column": 33 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "subscriber", "range": [ 1926, 1936 ], "loc": { "start": { "line": 47, "column": 46 }, "end": { "line": 47, "column": 56 } } }, { "type": "Identifier", "name": "source", "range": [ 1938, 1944 ], "loc": { "start": { "line": 47, "column": 58 }, "end": { "line": 47, "column": 64 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "windowSubscriber", "range": [ 1960, 1976 ], "loc": { "start": { "line": 48, "column": 12 }, "end": { "line": 48, "column": 28 } } }, "init": { "type": "NewExpression", "callee": { "type": "Identifier", "name": "WindowSubscriber", "range": [ 1983, 1999 ], "loc": { "start": { "line": 48, "column": 35 }, "end": { "line": 48, "column": 51 } } }, "arguments": [ { "type": "Identifier", "name": "subscriber", "range": [ 2000, 2010 ], "loc": { "start": { "line": 48, "column": 52 }, "end": { "line": 48, "column": 62 } } } ], "range": [ 1979, 2011 ], "loc": { "start": { "line": 48, "column": 31 }, "end": { "line": 48, "column": 63 } } }, "range": [ 1960, 2011 ], "loc": { "start": { "line": 48, "column": 12 }, "end": { "line": 48, "column": 63 } } } ], "kind": "var", "range": [ 1956, 2012 ], "loc": { "start": { "line": 48, "column": 8 }, "end": { "line": 48, "column": 64 } } }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "sourceSubscription", "range": [ 2025, 2043 ], "loc": { "start": { "line": 49, "column": 12 }, "end": { "line": 49, "column": 30 } } }, "init": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "source", "range": [ 2046, 2052 ], "loc": { "start": { "line": 49, "column": 33 }, "end": { "line": 49, "column": 39 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 2053, 2063 ], "loc": { "start": { "line": 49, "column": 40 }, "end": { "line": 49, "column": 50 } } }, "range": [ 2046, 2063 ], "loc": { "start": { "line": 49, "column": 33 }, "end": { "line": 49, "column": 50 } } }, "arguments": [ { "type": "Identifier", "name": "windowSubscriber", "range": [ 2064, 2080 ], "loc": { "start": { "line": 49, "column": 51 }, "end": { "line": 49, "column": 67 } } } ], "range": [ 2046, 2081 ], "loc": { "start": { "line": 49, "column": 33 }, "end": { "line": 49, "column": 68 } } }, "range": [ 2025, 2081 ], "loc": { "start": { "line": 49, "column": 12 }, "end": { "line": 49, "column": 68 } } } ], "kind": "var", "range": [ 2021, 2082 ], "loc": { "start": { "line": 49, "column": 8 }, "end": { "line": 49, "column": 69 } } }, { "type": "IfStatement", "test": { "type": "UnaryExpression", "operator": "!", "argument": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "sourceSubscription", "range": [ 2096, 2114 ], "loc": { "start": { "line": 50, "column": 13 }, "end": { "line": 50, "column": 31 } } }, "property": { "type": "Identifier", "name": "closed", "range": [ 2115, 2121 ], "loc": { "start": { "line": 50, "column": 32 }, "end": { "line": 50, "column": 38 } } }, "range": [ 2096, 2121 ], "loc": { "start": { "line": 50, "column": 13 }, "end": { "line": 50, "column": 38 } } }, "prefix": true, "range": [ 2095, 2121 ], "loc": { "start": { "line": 50, "column": 12 }, "end": { "line": 50, "column": 38 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "windowSubscriber", "range": [ 2137, 2153 ], "loc": { "start": { "line": 51, "column": 12 }, "end": { "line": 51, "column": 28 } } }, "property": { "type": "Identifier", "name": "add", "range": [ 2154, 2157 ], "loc": { "start": { "line": 51, "column": 29 }, "end": { "line": 51, "column": 32 } } }, "range": [ 2137, 2157 ], "loc": { "start": { "line": 51, "column": 12 }, "end": { "line": 51, "column": 32 } } }, "arguments": [ { "type": "CallExpression", "callee": { "type": "Identifier", "name": "subscribeToResult", "range": [ 2158, 2175 ], "loc": { "start": { "line": 51, "column": 33 }, "end": { "line": 51, "column": 50 } } }, "arguments": [ { "typ