UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,381 lines 157 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "Subscriber", "range": [ 9, 19 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 19 } } }, "imported": { "type": "Identifier", "name": "Subscriber", "range": [ 9, 19 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 19 } } }, "range": [ 9, 19 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 19 } } } ], "source": { "type": "Literal", "value": "../Subscriber", "raw": "'../Subscriber'", "range": [ 27, 42 ], "loc": { "start": { "line": 1, "column": 27 }, "end": { "line": 1, "column": 42 } } }, "range": [ 0, 43 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 43 } }, "trailingComments": [ { "type": "Block", "value": "*\n * Returns an Observable that mirrors the source Observable, resubscribing to it if it calls `error` and the\n * predicate returns true for that specific exception and retry count.\n * If the source Observable calls `error`, this method will resubscribe to the source Observable for a maximum of\n * count resubscriptions (given as a number parameter) rather than propagating the `error` call.\n *\n * <img src=\"./img/retry.png\" width=\"100%\">\n *\n * Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted\n * during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second\n * time and emits: [1, 2, 3, 4, 5] then the complete stream of emissions and notifications\n * would be: [1, 2, 1, 2, 3, 4, 5, `complete`].\n * @param {number} number of retry attempts before failing.\n * @return {Observable} the source Observable modified with the retry logic.\n * @method retry\n * @owner Observable\n ", "range": [ 44, 1043 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 18, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "retry", "range": [ 1060, 1065 ], "loc": { "start": { "line": 19, "column": 16 }, "end": { "line": 19, "column": 21 } } }, "params": [ { "type": "Identifier", "name": "count", "range": [ 1066, 1071 ], "loc": { "start": { "line": 19, "column": 22 }, "end": { "line": 19, "column": 27 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "IfStatement", "test": { "type": "BinaryExpression", "operator": "===", "left": { "type": "Identifier", "name": "count", "range": [ 1083, 1088 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 13 } } }, "right": { "type": "UnaryExpression", "operator": "void", "argument": { "type": "Literal", "value": 0, "raw": "0", "range": [ 1098, 1099 ], "loc": { "start": { "line": 20, "column": 23 }, "end": { "line": 20, "column": 24 } } }, "prefix": true, "range": [ 1093, 1099 ], "loc": { "start": { "line": 20, "column": 18 }, "end": { "line": 20, "column": 24 } } }, "range": [ 1083, 1099 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 24 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "Identifier", "name": "count", "range": [ 1103, 1108 ], "loc": { "start": { "line": 20, "column": 28 }, "end": { "line": 20, "column": 33 } } }, "right": { "type": "UnaryExpression", "operator": "-", "argument": { "type": "Literal", "value": 1, "raw": "1", "range": [ 1112, 1113 ], "loc": { "start": { "line": 20, "column": 37 }, "end": { "line": 20, "column": 38 } } }, "prefix": true, "range": [ 1111, 1113 ], "loc": { "start": { "line": 20, "column": 36 }, "end": { "line": 20, "column": 38 } } }, "range": [ 1103, 1113 ], "loc": { "start": { "line": 20, "column": 28 }, "end": { "line": 20, "column": 38 } } }, "range": [ 1103, 1114 ], "loc": { "start": { "line": 20, "column": 28 }, "end": { "line": 20, "column": 39 } } } ], "range": [ 1101, 1116 ], "loc": { "start": { "line": 20, "column": 26 }, "end": { "line": 20, "column": 41 } } }, "alternate": null, "range": [ 1079, 1116 ], "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 41 } } }, { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1128, 1132 ], "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 1133, 1137 ], "loc": { "start": { "line": 21, "column": 16 }, "end": { "line": 21, "column": 20 } } }, "range": [ 1128, 1137 ], "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "RetryOperator", "range": [ 1142, 1155 ], "loc": { "start": { "line": 21, "column": 25 }, "end": { "line": 21, "column": 38 } } }, "arguments": [ { "type": "Identifier", "name": "count", "range": [ 1156, 1161 ], "loc": { "start": { "line": 21, "column": 39 }, "end": { "line": 21, "column": 44 } } }, { "type": "ThisExpression", "range": [ 1163, 1167 ], "loc": { "start": { "line": 21, "column": 46 }, "end": { "line": 21, "column": 50 } } } ], "range": [ 1138, 1168 ], "loc": { "start": { "line": 21, "column": 21 }, "end": { "line": 21, "column": 51 } } } ], "range": [ 1128, 1169 ], "loc": { "start": { "line": 21, "column": 11 }, "end": { "line": 21, "column": 52 } } }, "range": [ 1121, 1170 ], "loc": { "start": { "line": 21, "column": 4 }, "end": { "line": 21, "column": 53 } } } ], "range": [ 1073, 1172 ], "loc": { "start": { "line": 19, "column": 29 }, "end": { "line": 22, "column": 1 } } }, "generator": false, "expression": false, "range": [ 1051, 1172 ], "loc": { "start": { "line": 19, "column": 7 }, "end": { "line": 22, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Returns an Observable that mirrors the source Observable, resubscribing to it if it calls `error` and the\n * predicate returns true for that specific exception and retry count.\n * If the source Observable calls `error`, this method will resubscribe to the source Observable for a maximum of\n * count resubscriptions (given as a number parameter) rather than propagating the `error` call.\n *\n * <img src=\"./img/retry.png\" width=\"100%\">\n *\n * Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted\n * during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second\n * time and emits: [1, 2, 3, 4, 5] then the complete stream of emissions and notifications\n * would be: [1, 2, 1, 2, 3, 4, 5, `complete`].\n * @param {number} number of retry attempts before failing.\n * @return {Observable} the source Observable modified with the retry logic.\n * @method retry\n * @owner Observable\n ", "range": [ 44, 1043 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 18, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 1044, 1172 ], "loc": { "start": { "line": 19, "column": 0 }, "end": { "line": 22, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Returns an Observable that mirrors the source Observable, resubscribing to it if it calls `error` and the\n * predicate returns true for that specific exception and retry count.\n * If the source Observable calls `error`, this method will resubscribe to the source Observable for a maximum of\n * count resubscriptions (given as a number parameter) rather than propagating the `error` call.\n *\n * <img src=\"./img/retry.png\" width=\"100%\">\n *\n * Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted\n * during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second\n * time and emits: [1, 2, 3, 4, 5] then the complete stream of emissions and notifications\n * would be: [1, 2, 1, 2, 3, 4, 5, `complete`].\n * @param {number} number of retry attempts before failing.\n * @return {Observable} the source Observable modified with the retry logic.\n * @method retry\n * @owner Observable\n ", "range": [ 44, 1043 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 18, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "RetryOperator", "range": [ 1177, 1190 ], "loc": { "start": { "line": 23, "column": 4 }, "end": { "line": 23, "column": 17 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "RetryOperator", "range": [ 1221, 1234 ], "loc": { "start": { "line": 24, "column": 13 }, "end": { "line": 24, "column": 26 } } }, "params": [ { "type": "Identifier", "name": "count", "range": [ 1235, 1240 ], "loc": { "start": { "line": 24, "column": 27 }, "end": { "line": 24, "column": 32 } } }, { "type": "Identifier", "name": "source", "range": [ 1242, 1248 ], "loc": { "start": { "line": 24, "column": 34 }, "end": { "line": 24, "column": 40 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1260, 1264 ], "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 12 } } }, "property": { "type": "Identifier", "name": "count", "range": [ 1265, 1270 ], "loc": { "start": { "line": 25, "column": 13 }, "end": { "line": 25, "column": 18 } } }, "range": [ 1260, 1270 ], "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 18 } } }, "right": { "type": "Identifier", "name": "count", "range": [ 1273, 1278 ], "loc": { "start": { "line": 25, "column": 21 }, "end": { "line": 25, "column": 26 } } }, "range": [ 1260, 1278 ], "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 26 } } }, "range": [ 1260, 1279 ], "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 27 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1288, 1292 ], "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 12 } } }, "property": { "type": "Identifier", "name": "source", "range": [ 1293, 1299 ], "loc": { "start": { "line": 26, "column": 13 }, "end": { "line": 26, "column": 19 } } }, "range": [ 1288, 1299 ], "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 19 } } }, "right": { "type": "Identifier", "name": "source", "range": [ 1302, 1308 ], "loc": { "start": { "line": 26, "column": 22 }, "end": { "line": 26, "column": 28 } } }, "range": [ 1288, 1308 ], "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 28 } } }, "range": [ 1288, 1309 ], "loc": { "start": { "line": 26, "column": 8 }, "end": { "line": 26, "column": 29 } } } ], "range": [ 1250, 1315 ], "loc": { "start": { "line": 24, "column": 42 }, "end": { "line": 27, "column": 5 } } }, "generator": false, "expression": false, "range": [ 1212, 1315 ], "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 27, "column": 5 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "RetryOperator", "range": [ 1320, 1333 ], "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 17 } } }, "property": { "type": "Identifier", "name": "prototype", "range": [ 1334, 1343 ], "loc": { "start": { "line": 28, "column": 18 }, "end": { "line": 28, "column": 27 } } }, "range": [ 1320, 1343 ], "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 27 } } }, "property": { "type": "Identifier", "name": "call", "range": [ 1344, 1348 ], "loc": { "start": { "line": 28, "column": 28 }, "end": { "line": 28, "column": 32 } } }, "range": [ 1320, 1348 ], "loc": { "start": { "line": 28, "column": 4 }, "end": { "line": 28, "column": 32 } } }, "right": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "subscriber", "range": [ 1361, 1371 ], "loc": { "start": { "line": 28, "column": 45 }, "end": { "line": 28, "column": 55 } } }, { "type": "Identifier", "name": "source", "range": [ 1373, 1379 ], "loc": { "start": { "line": 28, "column": 57 }, "end": { "line": 28, "column": 63 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "source", "range": [ 1398, 1404 ], "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 21 } } }, "property": { "type": "Identifier", "name": "_subscribe", "range": [ 1405, 1415 ], "loc": { "start": { "line": 29, "column": 22 }, "end": { "line": 29, "column": 32 } } }, "range": [ 1398, 1415 ], "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 32 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "RetrySubscriber", "range": [ 1420, 1435 ], "loc": { "start": { "line": 29, "column": 37 }, "end": { "line": 29, "column": 52 } } }, "arguments": [ { "type": "Identifier", "name": "subscriber", "range": [ 1436, 1446 ], "loc": { "start": { "line": 29, "column": 53 }, "end": { "line": 29, "column": 63 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1448, 1452 ], "loc": { "start": { "line": 29, "column": 65 }, "end": { "line": 29, "column": 69 } } }, "property": { "type": "Identifier", "name": "count", "range": [ 1453, 1458 ], "loc": { "start": { "line": 29, "column": 70 }, "end": { "line": 29, "column": 75 } } }, "range": [ 1448, 1458 ], "loc": { "start": { "line": 29, "column": 65 }, "end": { "line": 29, "column": 75 } } }, { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 1460, 1464 ], "loc": { "start": { "line": 29, "column": 77 }, "end": { "line": 29, "column": 81 } } }, "property": { "type": "Identifier", "name": "source", "range": [ 1465, 1471 ], "loc": { "start": { "line": 29, "column": 82 }, "end": { "line": 29, "column": 88 } } }, "range": [ 1460, 1471 ], "loc": { "start": { "line": 29, "column": 77 }, "end": { "line": 29, "column": 88 } } } ], "range": [ 1416, 1472 ], "loc": { "start": { "line": 29, "column": 33 }, "end": { "line": 29, "column": 89 } } } ], "range": [ 1398, 1473 ], "loc": { "start": { "line": 29, "column": 15 }, "end": { "line": 29, "column": 90 } } }, "range": [ 1391, 1474 ], "loc": { "start": { "line": 29, "column": 8 }, "end": { "line": 29, "column": 91 } } } ], "range": [ 1381, 1480 ], "loc": { "start": { "line": 28, "column": 65 }, "end": { "line": 30, "column": 5 } } }, "generator": false, "expression": false, "range": [ 1351, 1480 ], "loc": { "start": { "line": 28, "column": 35 }, "end": { "line": 30, "column": 5 } } }, "range": [ 1320, 1480 ], "loc": { "start": { "line"