UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,520 lines (1,519 loc) 543 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": "Subscription", "range": [ 47, 59 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 21 } } }, "imported": { "type": "Identifier", "name": "Subscription", "range": [ 47, 59 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 21 } } }, "range": [ 47, 59 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 21 } } } ], "source": { "type": "Literal", "value": "../Subscription", "raw": "'../Subscription'", "range": [ 67, 84 ], "loc": { "start": { "line": 2, "column": 29 }, "end": { "line": 2, "column": 46 } } }, "range": [ 38, 85 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 47 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "tryCatch", "range": [ 95, 103 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 } } }, "imported": { "type": "Identifier", "name": "tryCatch", "range": [ 95, 103 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 } } }, "range": [ 95, 103 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 17 } } } ], "source": { "type": "Literal", "value": "../util/tryCatch", "raw": "'../util/tryCatch'", "range": [ 111, 129 ], "loc": { "start": { "line": 3, "column": 25 }, "end": { "line": 3, "column": 43 } } }, "range": [ 86, 130 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 44 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "errorObject", "range": [ 140, 151 ], "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 20 } } }, "imported": { "type": "Identifier", "name": "errorObject", "range": [ 140, 151 ], "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 20 } } }, "range": [ 140, 151 ], "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 20 } } } ], "source": { "type": "Literal", "value": "../util/errorObject", "raw": "'../util/errorObject'", "range": [ 159, 180 ], "loc": { "start": { "line": 4, "column": 28 }, "end": { "line": 4, "column": 49 } } }, "range": [ 131, 181 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 50 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "OuterSubscriber", "range": [ 191, 206 ], "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 24 } } }, "imported": { "type": "Identifier", "name": "OuterSubscriber", "range": [ 191, 206 ], "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 24 } } }, "range": [ 191, 206 ], "loc": { "start": { "line": 5, "column": 9 }, "end": { "line": 5, "column": 24 } } } ], "source": { "type": "Literal", "value": "../OuterSubscriber", "raw": "'../OuterSubscriber'", "range": [ 214, 234 ], "loc": { "start": { "line": 5, "column": 32 }, "end": { "line": 5, "column": 52 } } }, "range": [ 182, 235 ], "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 53 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "subscribeToResult", "range": [ 245, 262 ], "loc": { "start": { "line": 6, "column": 9 }, "end": { "line": 6, "column": 26 } } }, "imported": { "type": "Identifier", "name": "subscribeToResult", "range": [ 245, 262 ], "loc": { "start": { "line": 6, "column": 9 }, "end": { "line": 6, "column": 26 } } }, "range": [ 245, 262 ], "loc": { "start": { "line": 6, "column": 9 }, "end": { "line": 6, "column": 26 } } } ], "source": { "type": "Literal", "value": "../util/subscribeToResult", "raw": "'../util/subscribeToResult'", "range": [ 270, 297 ], "loc": { "start": { "line": 6, "column": 34 }, "end": { "line": 6, "column": 61 } } }, "range": [ 236, 298 ], "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 62 } }, "trailingComments": [ { "type": "Block", "value": "*\n * Branch out the source Observable values as a nested Observable starting from\n * an emission from `openings` and ending when the output of `closingSelector`\n * emits.\n *\n * <span class=\"informal\">It's like {@link bufferToggle}, but emits a nested\n * Observable instead of an array.</span>\n *\n * <img src=\"./img/windowToggle.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits windows that contain those items\n * emitted by the source Observable between the time when the `openings`\n * Observable emits an item and when the Observable returned by\n * `closingSelector` emits an item.\n *\n * @example <caption>Every other second, emit the click events from the next 500ms</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var openings = Rx.Observable.interval(1000);\n * var result = clicks.windowToggle(openings, i =>\n * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty()\n * ).mergeAll();\n * result.subscribe(x => console.log(x));\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowWhen}\n * @see {@link bufferToggle}\n *\n * @param {Observable<O>} openings An observable of notifications to start new\n * windows.\n * @param {function(value: O): Observable} closingSelector A function that takes\n * the value emitted by the `openings` observable and returns an Observable,\n * which, when it emits (either `next` or `complete`), signals that the\n * associated window should complete.\n * @return {Observable<Observable<T>>} An observable of windows, which in turn\n * are Observables.\n * @method windowToggle\n * @owner Observable\n ", "range": [ 299, 2006 ], "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 47, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "windowToggle", "range": [ 2023, 2035 ], "loc": { "start": { "line": 48, "column": 16 }, "end": { "line": 48, "column": 28 } } }, "params": [ { "type": "Identifier", "name": "openings", "range": [ 2036, 2044 ], "loc": { "start": { "line": 48, "column": 29 }, "end": { "line": 48, "column": 37 } } }, { "type": "Identifier", "name": "closingSelector", "range": [ 2046, 2061 ], "loc": { "start": { "line": 48, "column": 39 }, "end": { "line": 48, "column": 54 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2076, 2080 ], "loc": { "start": { "line": 49, "column": 11 }, "end": { "line": 49, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 2081, 2085 ], "loc": { "start": { "line": 49, "column": 16 }, "end": { "line": 49, "column": 20 } } }, "range": [ 2076, 2085 ], "loc": { "start": { "line": 49, "column": 11 }, "end": { "line": 49, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "WindowToggleOperator", "range": [ 2090, 2110 ], "loc": { "start": { "line": 49, "column": 25 }, "end": { "line": 49, "column": 45 } } }, "arguments": [ { "type": "Identifier", "name": "openings", "range": [ 2111, 2119 ], "loc": { "start": { "line": 49, "column": 46 }, "end": { "line": 49, "column": 54 } } }, { "type": "Identifier", "name": "closingSelector", "range": [ 2121, 2136 ], "loc": { "start": { "line": 49, "column": 56 }, "end": { "line": 49, "column": 71 } } } ], "range": [ 2086, 2137 ], "loc": { "start": { "line": 49, "column": 21 }, "end": { "line": 49, "column": 72 } } } ], "range": [ 2076, 2138 ], "loc": { "start": { "line": 49, "column": 11 }, "end": { "line": 49, "column": 73 } } }, "range": [ 2069, 2139 ], "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 49, "column": 74 } } } ], "range": [ 2063, 2141 ], "loc": { "start": { "line": 48, "column": 56 }, "end": { "line": 50, "column": 1 } } }, "generator": false, "expression": false, "range": [ 2014, 2141 ], "loc": { "start": { "line": 48, "column": 7 }, "end": { "line": 50, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Branch out the source Observable values as a nested Observable starting from\n * an emission from `openings` and ending when the output of `closingSelector`\n * emits.\n *\n * <span class=\"informal\">It's like {@link bufferToggle}, but emits a nested\n * Observable instead of an array.</span>\n *\n * <img src=\"./img/windowToggle.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits windows that contain those items\n * emitted by the source Observable between the time when the `openings`\n * Observable emits an item and when the Observable returned by\n * `closingSelector` emits an item.\n *\n * @example <caption>Every other second, emit the click events from the next 500ms</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var openings = Rx.Observable.interval(1000);\n * var result = clicks.windowToggle(openings, i =>\n * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty()\n * ).mergeAll();\n * result.subscribe(x => console.log(x));\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowWhen}\n * @see {@link bufferToggle}\n *\n * @param {Observable<O>} openings An observable of notifications to start new\n * windows.\n * @param {function(value: O): Observable} closingSelector A function that takes\n * the value emitted by the `openings` observable and returns an Observable,\n * which, when it emits (either `next` or `complete`), signals that the\n * associated window should complete.\n * @return {Observable<Observable<T>>} An observable of windows, which in turn\n * are Observables.\n * @method windowToggle\n * @owner Observable\n ", "range": [ 299, 2006 ], "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 47, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 2007, 2141 ], "loc": { "start": { "line": 48, "column": 0 }, "end": { "line": 50, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Branch out the source Observable values as a nested Observable starting from\n * an emission from `openings` and ending when the output of `closingSelector`\n * emits.\n *\n * <span class=\"informal\">It's like {@link bufferToggle}, but emits a nested\n * Observable instead of an array.</span>\n *\n * <img src=\"./img/windowToggle.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable emits windows that contain those items\n * emitted by the source Observable between the time when the `openings`\n * Observable emits an item and when the Observable returned by\n * `closingSelector` emits an item.\n *\n * @example <caption>Every other second, emit the click events from the next 500ms</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var openings = Rx.Observable.interval(1000);\n * var result = clicks.windowToggle(openings, i =>\n * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty()\n * ).mergeAll();\n * result.subscribe(x => console.log(x));\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowTime}\n * @see {@link windowWhen}\n * @see {@link bufferToggle}\n *\n * @param {Observable<O>} openings An observable of notifications to start new\n * windows.\n * @param {function(value: O): Observable} closingSelector A function that takes\n * the value emitted by the `openings` observable and returns an Observable,\n * which, when it emits (either `next` or `complete`), signals that the\n * associated window should complete.\n * @return {Observable<Observable<T>>} An observable of windows, which in turn\n * are Observables.\n * @method windowToggle\n * @owner Observable\n ", "range": [ 299, 2006 ], "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 47, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "WindowToggleOperator", "range": [ 2146, 2166 ], "loc": { "start": { "line": 51, "column": 4 }, "end": { "line": 51, "column": 24 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "WindowToggleOperator", "range": [ 2197, 2217 ], "loc": { "start": { "line": 52, "column": 13 }, "end": { "line": 52, "column": 33 } } }, "params": [ { "type": "Identifier", "name": "openings", "range": [ 2218, 2226 ], "loc": { "start": { "line": 52, "column": 34 }, "end": { "line": 52, "column": 42 } } }, { "type": "Identifier", "name": "closingSelector", "range": [ 2228, 2243 ], "loc": { "start": { "line": 52, "column": 44 }, "end": { "line": 52, "column": 59 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2255, 2259 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 12 } } }, "property": { "type": "Identifier", "name": "openings", "range": [ 2260, 2268 ], "loc": { "start": { "line": 53, "column": 13 }, "end": { "line": 53, "column": 21 } } }, "range": [ 2255, 2268 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 21 } } }, "right": { "type": "Identifier", "name": "openings", "range": [ 2271, 2279 ], "loc": { "start": { "line": 53, "column": 24 }, "end": { "line": 53, "column": 32 } } }, "range": [ 2255, 2279 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 32 } } }, "range": [ 2255, 2280 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 33 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2289, 2293 ], "loc": { "start": { "line": 54, "column": 8 }, "end": { "line": 54, "column": 12 } } }, "property": { "type": "Identifier", "name": "closingSelector", "range": [ 2294, 2309 ], "loc": { "start": { "line": 54, "column": 13 }, "end": { "line": 54, "column": 28 } } }, "range": [ 2289, 2309 ], "loc": { "start": { "line": 54, "column": 8 }, "end": { "line": 54, "column": 28 } } }, "right": { "type": "Identifier", "name": "closingSelector", "range": [ 2312, 2327 ], "loc": { "start": { "line": 54, "column": 31 }, "end": { "line": 54, "column": 46 } } }, "range": [ 2289, 2327 ], "loc": { "start": { "line": 54, "column": 8 }, "end": { "line": 54, "column": 46 } } }, "range": [ 2289, 2328 ], "loc": { "start": { "line": 54, "column": 8 }, "end": { "line": 54, "column": 47 } } } ], "range": [ 2245, 2334 ], "loc": { "start": { "line": 52, "column": 61 }, "end": { "line": 55, "column": 5 } } }, "generator": false, "expression": false, "range": [ 2188, 2334 ], "loc": { "start": { "line": 52, "column": 4 }, "end": { "line": 55, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "WindowToggleOperator", "range": [ 2339, 2359 ], "loc": { "start": { "line": 56, "column": 4 }, "end": { "line": 56, "column": 24 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 2360, 2369 ], "loc": { "start": { "line": 56, "column": 25 }, "end": { "line": 56, "column": 34 } } }, "range": [ 2339, 2369 ], "loc": { "start": { "line": 56, "column": 4 }, "end": { "line": 56, "column": 34 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 2370, 2374 ], "loc": { "start": { "line": 56, "column": 35 }, "end": { "line": 56, "column": 39 } } }, "range": [ 2339, 2374 ], "loc": { "start": { "line": 56, "column": 4 }, "end": { "line": 56, "column": 39 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "subscriber", "range": [ 2387, 2397 ], "loc": { "start": { "line": 56, "column": 52 }, "end": { "line": 56, "column": 62 } } }, { "type": "Identifier", "name": "source", "range": [ 2399, 2405 ], "loc": { "start": { "line": 56, "column": 64 }, "end": { "line": 56, "column": 70 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "source", "range": [ 2424, 2430 ], "loc": { "start": { "line": 57, "column": 15 }, "end": { "line": 57, "column": 21 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 2431, 2441 ], "loc": { "start": { "line": 57, "column": 22 }, "end": { "line": 57, "column": 32 } } }, "range": [ 2424, 2441 ], "loc": { "start": { "line": 57, "column": 15 }, "end": { "line": 57, "column": 32 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "WindowToggleSubscriber", "range": [ 2446, 2468 ], "loc": { "start": { "line": 57, "column": 37 }, "end": { "line": 57, "column": 59 } } }, "arguments": [ { "type": "Identifier", "name": "subscriber", "range": [ 2469, 2479 ], "loc": { "start": { "line": 57, "column": 60 }, "end": { "line": 57, "column": 70 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2481, 2485 ], "loc": { "start": { "line": 57, "column": 72 }, "end": { "line": 57, "column": 76 } } }, "property": { "type": "Identifier", "name": "openings", "range": [ 2486, 2494 ], "loc": { "start": { "line": 57, "column": 77 }, "end": { "line": 57, "column": 85 } } }, "range": [ 2481, 2494 ], "loc": { "start": { "line": 57, "column": 72 }, "end": { "line": 57, "column": 85 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [