UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,295 lines 378 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "root", "range": [ 9, 13 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 13 } } }, "imported": { "type": "Identifier", "name": "root", "range": [ 9, 13 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 13 } } }, "range": [ 9, 13 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 13 } } } ], "source": { "type": "Literal", "value": "../util/root", "raw": "'../util/root'", "range": [ 21, 35 ], "loc": { "start": { "line": 1, "column": 21 }, "end": { "line": 1, "column": 35 } } }, "range": [ 0, 36 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 36 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "Observable", "range": [ 46, 56 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 19 } } }, "imported": { "type": "Identifier", "name": "Observable", "range": [ 46, 56 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 19 } } }, "range": [ 46, 56 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 19 } } } ], "source": { "type": "Literal", "value": "../Observable", "raw": "'../Observable'", "range": [ 64, 79 ], "loc": { "start": { "line": 2, "column": 27 }, "end": { "line": 2, "column": 42 } } }, "range": [ 37, 80 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 43 } }, "trailingComments": [ { "type": "Block", "value": "*\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n ", "range": [ 81, 175 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 7, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "PromiseObservable", "range": [ 187, 204 ], "loc": { "start": { "line": 8, "column": 11 }, "end": { "line": 8, "column": 28 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "_super", "range": [ 218, 224 ], "loc": { "start": { "line": 8, "column": 42 }, "end": { "line": 8, "column": 48 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "Identifier", "name": "__extends", "range": [ 232, 241 ], "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 13 } } }, "arguments": [ { "type": "Identifier", "name": "PromiseObservable", "range": [ 242, 259 ], "loc": { "start": { "line": 9, "column": 14 }, "end": { "line": 9, "column": 31 } } }, { "type": "Identifier", "name": "_super", "range": [ 261, 267 ], "loc": { "start": { "line": 9, "column": 33 }, "end": { "line": 9, "column": 39 } } } ], "range": [ 232, 268 ], "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 40 } } }, "range": [ 232, 269 ], "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 41 } } }, { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "PromiseObservable", "range": [ 283, 300 ], "loc": { "start": { "line": 10, "column": 13 }, "end": { "line": 10, "column": 30 } } }, "params": [ { "type": "Identifier", "name": "promise", "range": [ 301, 308 ], "loc": { "start": { "line": 10, "column": 31 }, "end": { "line": 10, "column": 38 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 310, 319 ], "loc": { "start": { "line": 10, "column": 40 }, "end": { "line": 10, "column": 49 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "_super", "range": [ 331, 337 ], "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 14 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 338, 342 ], "loc": { "start": { "line": 11, "column": 15 }, "end": { "line": 11, "column": 19 } } }, "range": [ 331, 342 ], "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 19 } } }, "arguments": [ { "type": "ThisExpression", "range": [ 343, 347 ], "loc": { "start": { "line": 11, "column": 20 }, "end": { "line": 11, "column": 24 } } } ], "range": [ 331, 348 ], "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 25 } } }, "range": [ 331, 349 ], "loc": { "start": { "line": 11, "column": 8 }, "end": { "line": 11, "column": 26 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 358, 362 ], "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 12 } } }, "property": { "type": "Identifier", "name": "promise", "range": [ 363, 370 ], "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 12, "column": 20 } } }, "range": [ 358, 370 ], "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 20 } } }, "right": { "type": "Identifier", "name": "promise", "range": [ 373, 380 ], "loc": { "start": { "line": 12, "column": 23 }, "end": { "line": 12, "column": 30 } } }, "range": [ 358, 380 ], "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 30 } } }, "range": [ 358, 381 ], "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 31 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 390, 394 ], "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 12 } } }, "property": { "type": "Identifier", "name": "scheduler", "range": [ 395, 404 ], "loc": { "start": { "line": 13, "column": 13 }, "end": { "line": 13, "column": 22 } } }, "range": [ 390, 404 ], "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 22 } } }, "right": { "type": "Identifier", "name": "scheduler", "range": [ 407, 416 ], "loc": { "start": { "line": 13, "column": 25 }, "end": { "line": 13, "column": 34 } } }, "range": [ 390, 416 ], "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 34 } } }, "range": [ 390, 417 ], "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 35 } } } ], "range": [ 321, 423 ], "loc": { "start": { "line": 10, "column": 51 }, "end": { "line": 14, "column": 5 } } }, "generator": false, "expression": false, "range": [ 274, 423 ], "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 14, "column": 5 } }, "trailingComments": [ { "type": "Block", "value": "*\n * Converts a Promise to an Observable.\n *\n * <span class=\"informal\">Returns an Observable that just emits the Promise's\n * resolved value, then completes.</span>\n *\n * Converts an ES2015 Promise or a Promises/A+ spec compliant Promise to an\n * Observable. If the Promise resolves with a value, the output Observable\n * emits that resolved value as a `next`, and then completes. If the Promise\n * is rejected, then the output Observable emits the corresponding Error.\n *\n * @example <caption>Convert the Promise returned by Fetch to an Observable</caption>\n * var result = Rx.Observable.fromPromise(fetch('http://myserver.com/'));\n * result.subscribe(x => console.log(x), e => console.error(e));\n *\n * @see {@link bindCallback}\n * @see {@link from}\n *\n * @param {Promise<T>} promise The promise to be converted.\n * @param {Scheduler} [scheduler] An optional Scheduler to use for scheduling\n * the delivery of the resolved value (or the rejection).\n * @return {Observable<T>} An Observable which wraps the Promise.\n * @static true\n * @name fromPromise\n * @owner Observable\n ", "range": [ 428, 1607 ], "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 40, "column": 7 } } } ] }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "PromiseObservable", "range": [ 1612, 1629 ], "loc": { "start": { "line": 41, "column": 4 }, "end": { "line": 41, "column": 21 } } }, "property": { "type": "Identifier", "name": "create", "range": [ 1630, 1636 ], "loc": { "start": { "line": 41, "column": 22 }, "end": { "line": 41, "column": 28 } } }, "range": [ 1612, 1636 ], "loc": { "start": { "line": 41, "column": 4 }, "end": { "line": 41, "column": 28 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "promise", "range": [ 1649, 1656 ], "loc": { "start": { "line": 41, "column": 41 }, "end": { "line": 41, "column": 48 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 1658, 1667 ], "loc": { "start": { "line": 41, "column": 50 }, "end": { "line": 41, "column": 59 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "NewExpression", "callee": { "type": "Identifier", "name": "PromiseObservable", "range": [ 1690, 1707 ], "loc": { "start": { "line": 42, "column": 19 }, "end": { "line": 42, "column": 36 } } }, "arguments": [ { "type": "Identifier", "name": "promise", "range": [ 1708, 1715 ], "loc": { "start": { "line": 42, "column": 37 }, "end": { "line": 42, "column": 44 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 1717, 1726 ], "loc": { "start": { "line": 42, "column": 46 }, "end": { "line": 42, "column": 55 } } } ], "range": [ 1686, 1727 ], "loc": { "start": { "line": 42, "column": 15 }, "end": { "line": 42, "column": 56 } } }, "range": [ 1679, 1728 ], "loc": { "start": { "line": 42, "column": 8 }, "end": { "line": 42, "column": 57 } } } ], "range": [ 1669, 1734 ], "loc": { "start": { "line": 41, "column": 61 }, "end": { "line": 43, "column": 5 } } }, "generator": false, "expression": false, "range": [ 1639, 1734 ], "loc": { "start": { "line": 41, "column": 31 }, "end": { "line": 43, "column": 5 } } }, "range": [ 1612, 1734 ], "loc": { "start": { "line": 41, "column": 4 }, "end": { "line": 43, "column": 5 } } }, "range": [ 1612, 1735 ], "loc": { "start": { "line": 41, "column": 4 }, "end": { "line": 43, "column": 6 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Converts a Promise to an Observable.\n *\n * <span class=\"informal\">Returns an Observable that just emits the Promise's\n * resolved value, then completes.</span>\n *\n * Converts an ES2015 Promise or a Promises/A+ spec compliant Promise to an\n * Observable. If the Promise resolves with a value, the output Observable\n * emits that resolved value as a `next`, and then completes. If the Promise\n * is rejected, then the output Observable emits the corresponding Error.\n *\n * @example <caption>Convert the Promise returned by Fetch to an Observable</caption>\n * var result = Rx.Observable.fromPromise(fetch('http://myserver.com/'));\n * result.subscribe(x => console.log(x), e => console.error(e));\n *\n * @see {@link bindCallback}\n * @see {@link from}\n *\n * @param {Promise<T>} promise The promise to be converted.\n * @param {Scheduler} [scheduler] An optional Scheduler to use for scheduling\n * the delivery of the resolved value (or the rejection).\n * @return {Observable<T>} An Observable which wraps the Promise.\n * @static true\n * @name fromPromise\n * @owner Observable\n ", "range": [ 428, 1607 ], "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 40, "column": 7 } } } ] }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "PromiseObservable", "range": [ 1740, 1757 ], "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 44, "column": 21 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 1758, 1767 ], "loc": { "start": { "line": 44, "column": 22 }, "end": { "line": 44, "column": 31 } } }, "range": [ 1740, 1767 ], "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 44, "column": 31 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 1768, 1778 ], "loc": { "start": { "line": 44, "column": 32 }, "end": { "line": 44, "column": 42 } } }, "range": [ 1740, 1778 ], "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 44, "column": 42 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "subscriber", "range": [ 1791, 1801 ], "loc": { "start": { "line": 44, "column": 55 }, "end": { "line": 44, "column": 65 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "_this", "range": [ 1817, 1822 ], "loc": { "start": { "line": 45, "column": 12 }, "end": { "line": 45, "column": 17 } } }, "init": { "type": "ThisExpression", "range": [ 1825, 1829 ], "loc": { "start": { "line": 45, "column": 20 }, "end": { "line": 45, "column": 24 } } }, "range": [ 1817, 1829 ], "loc": { "start": { "line": 45, "column": 12 }, "end": { "line": 45, "column": 24 } } } ], "kind": "var", "range": [ 1813, 1830 ], "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 25 } } }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "promise", "range": [ 1843, 1850 ], "loc": { "start": { "line": 46, "column": 12 }, "end": { "line": 46, "column": 19 } } }, "init": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1853, 1857 ], "loc": { "start": { "line": 46, "column": 22 }, "end": { "line": 46, "column": 26 } } }, "property": { "type": "Ident