UNPKG

@reactivex/rxjs

Version:

Reactive Extensions for modern JavaScript

1,573 lines (1,572 loc) 358 kB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "async", "range": [ 9, 14 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 14 } } }, "imported": { "type": "Identifier", "name": "async", "range": [ 9, 14 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 14 } } }, "range": [ 9, 14 ], "loc": { "start": { "line": 1, "column": 9 }, "end": { "line": 1, "column": 14 } } } ], "source": { "type": "Literal", "value": "../scheduler/async", "raw": "'../scheduler/async'", "range": [ 22, 42 ], "loc": { "start": { "line": 1, "column": 22 }, "end": { "line": 1, "column": 42 } } }, "range": [ 0, 43 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 43 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "isDate", "range": [ 53, 59 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 15 } } }, "imported": { "type": "Identifier", "name": "isDate", "range": [ 53, 59 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 15 } } }, "range": [ 53, 59 ], "loc": { "start": { "line": 2, "column": 9 }, "end": { "line": 2, "column": 15 } } } ], "source": { "type": "Literal", "value": "../util/isDate", "raw": "'../util/isDate'", "range": [ 67, 83 ], "loc": { "start": { "line": 2, "column": 23 }, "end": { "line": 2, "column": 39 } } }, "range": [ 44, 84 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 40 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "Subscriber", "range": [ 94, 104 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 19 } } }, "imported": { "type": "Identifier", "name": "Subscriber", "range": [ 94, 104 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 19 } } }, "range": [ 94, 104 ], "loc": { "start": { "line": 3, "column": 9 }, "end": { "line": 3, "column": 19 } } } ], "source": { "type": "Literal", "value": "../Subscriber", "raw": "'../Subscriber'", "range": [ 112, 127 ], "loc": { "start": { "line": 3, "column": 27 }, "end": { "line": 3, "column": 42 } } }, "range": [ 85, 128 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 43 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "Notification", "range": [ 138, 150 ], "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 21 } } }, "imported": { "type": "Identifier", "name": "Notification", "range": [ 138, 150 ], "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 21 } } }, "range": [ 138, 150 ], "loc": { "start": { "line": 4, "column": 9 }, "end": { "line": 4, "column": 21 } } } ], "source": { "type": "Literal", "value": "../Notification", "raw": "'../Notification'", "range": [ 158, 175 ], "loc": { "start": { "line": 4, "column": 29 }, "end": { "line": 4, "column": 46 } } }, "range": [ 129, 176 ], "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 47 } }, "trailingComments": [ { "type": "Block", "value": "*\n * Delays the emission of items from the source Observable by a given timeout or\n * until a given Date.\n *\n * <span class=\"informal\">Time shifts each item by some specified amount of\n * milliseconds.</span>\n *\n * <img src=\"./img/delay.png\" width=\"100%\">\n *\n * If the delay argument is a Number, this operator time shifts the source\n * Observable by that amount of time expressed in milliseconds. The relative\n * time intervals between the values are preserved.\n *\n * If the delay argument is a Date, this operator time shifts the start of the\n * Observable execution until the given date occurs.\n *\n * @example <caption>Delay each click by one second</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second\n * delayedClicks.subscribe(x => console.log(x));\n *\n * @example <caption>Delay all clicks until a future date happens</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var date = new Date('March 15, 2050 12:00:00'); // in the future\n * var delayedClicks = clicks.delay(date); // click emitted only after that date\n * delayedClicks.subscribe(x => console.log(x));\n *\n * @see {@link debounceTime}\n * @see {@link delayWhen}\n *\n * @param {number|Date} delay The delay duration in milliseconds (a `number`) or\n * a `Date` until which the emission of the source items is delayed.\n * @param {Scheduler} [scheduler=async] The Scheduler to use for\n * managing the timers that handle the time-shift for each item.\n * @return {Observable} An Observable that delays the emissions of the source\n * Observable by the specified timeout or Date.\n * @method delay\n * @owner Observable\n ", "range": [ 177, 1876 ], "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 43, "column": 3 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "delay", "range": [ 1893, 1898 ], "loc": { "start": { "line": 44, "column": 16 }, "end": { "line": 44, "column": 21 } } }, "params": [ { "type": "Identifier", "name": "delay", "range": [ 1899, 1904 ], "loc": { "start": { "line": 44, "column": 22 }, "end": { "line": 44, "column": 27 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 1906, 1915 ], "loc": { "start": { "line": 44, "column": 29 }, "end": { "line": 44, "column": 38 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "IfStatement", "test": { "type": "BinaryExpression", "operator": "===", "left": { "type": "Identifier", "name": "scheduler", "range": [ 1927, 1936 ], "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 17 } } }, "right": { "type": "UnaryExpression", "operator": "void", "argument": { "type": "Literal", "value": 0, "raw": "0", "range": [ 1946, 1947 ], "loc": { "start": { "line": 45, "column": 27 }, "end": { "line": 45, "column": 28 } } }, "prefix": true, "range": [ 1941, 1947 ], "loc": { "start": { "line": 45, "column": 22 }, "end": { "line": 45, "column": 28 } } }, "range": [ 1927, 1947 ], "loc": { "start": { "line": 45, "column": 8 }, "end": { "line": 45, "column": 28 } } }, "consequent": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "Identifier", "name": "scheduler", "range": [ 1951, 1960 ], "loc": { "start": { "line": 45, "column": 32 }, "end": { "line": 45, "column": 41 } } }, "right": { "type": "Identifier", "name": "async", "range": [ 1963, 1968 ], "loc": { "start": { "line": 45, "column": 44 }, "end": { "line": 45, "column": 49 } } }, "range": [ 1951, 1968 ], "loc": { "start": { "line": 45, "column": 32 }, "end": { "line": 45, "column": 49 } } }, "range": [ 1951, 1969 ], "loc": { "start": { "line": 45, "column": 32 }, "end": { "line": 45, "column": 50 } } } ], "range": [ 1949, 1971 ], "loc": { "start": { "line": 45, "column": 30 }, "end": { "line": 45, "column": 52 } } }, "alternate": null, "range": [ 1923, 1971 ], "loc": { "start": { "line": 45, "column": 4 }, "end": { "line": 45, "column": 52 } } }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "absoluteDelay", "range": [ 1980, 1993 ], "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 21 } } }, "init": { "type": "CallExpression", "callee": { "type": "Identifier", "name": "isDate", "range": [ 1996, 2002 ], "loc": { "start": { "line": 46, "column": 24 }, "end": { "line": 46, "column": 30 } } }, "arguments": [ { "type": "Identifier", "name": "delay", "range": [ 2003, 2008 ], "loc": { "start": { "line": 46, "column": 31 }, "end": { "line": 46, "column": 36 } } } ], "range": [ 1996, 2009 ], "loc": { "start": { "line": 46, "column": 24 }, "end": { "line": 46, "column": 37 } } }, "range": [ 1980, 2009 ], "loc": { "start": { "line": 46, "column": 8 }, "end": { "line": 46, "column": 37 } } } ], "kind": "var", "range": [ 1976, 2010 ], "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 46, "column": 38 } } }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "delayFor", "range": [ 2019, 2027 ], "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 16 } } }, "init": { "type": "ConditionalExpression", "test": { "type": "Identifier", "name": "absoluteDelay", "range": [ 2030, 2043 ], "loc": { "start": { "line": 47, "column": 19 }, "end": { "line": 47, "column": 32 } } }, "consequent": { "type": "BinaryExpression", "operator": "-", "left": { "type": "UnaryExpression", "operator": "+", "argument": { "type": "Identifier", "name": "delay", "range": [ 2048, 2053 ], "loc": { "start": { "line": 47, "column": 37 }, "end": { "line": 47, "column": 42 } } }, "prefix": true, "range": [ 2047, 2053 ], "loc": { "start": { "line": 47, "column": 36 }, "end": { "line": 47, "column": 42 } } }, "right": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "scheduler", "range": [ 2056, 2065 ], "loc": { "start": { "line": 47, "column": 45 }, "end": { "line": 47, "column": 54 } } }, "property": { "type": "Identifier", "name": "now", "range": [ 2066, 2069 ], "loc": { "start": { "line": 47, "column": 55 }, "end": { "line": 47, "column": 58 } } }, "range": [ 2056, 2069 ], "loc": { "start": { "line": 47, "column": 45 }, "end": { "line": 47, "column": 58 } } }, "arguments": [], "range": [ 2056, 2071 ], "loc": { "start": { "line": 47, "column": 45 }, "end": { "line": 47, "column": 60 } } }, "range": [ 2047, 2071 ], "loc": { "start": { "line": 47, "column": 36 }, "end": { "line": 47, "column": 60 } } }, "alternate": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", "name": "Math", "range": [ 2075, 2079 ], "loc": { "start": { "line": 47, "column": 64 }, "end": { "line": 47, "column": 68 } } }, "property": { "type": "Identifier", "name": "abs", "range": [ 2080, 2083 ], "loc": { "start": { "line": 47, "column": 69 }, "end": { "line": 47, "column": 72 } } }, "range": [ 2075, 2083 ], "loc": { "start": { "line": 47, "column": 64 }, "end": { "line": 47, "column": 72 } } }, "arguments": [ { "type": "Identifier", "name": "delay", "range": [ 2084, 2089 ], "loc": { "start": { "line": 47, "column": 73 }, "end": { "line": 47, "column": 78 } } } ], "range": [ 2075, 2090 ], "loc": { "start": { "line": 47, "column": 64 }, "end": { "line": 47, "column": 79 } } }, "range": [ 2030, 2090 ], "loc": { "start": { "line": 47, "column": 19 }, "end": { "line": 47, "column": 79 } } }, "range": [ 2019, 2090 ], "loc": { "start": { "line": 47, "column": 8 }, "end": { "line": 47, "column": 79 } } } ], "kind": "var", "range": [ 2015, 2091 ], "loc": { "start": { "line": 47, "column": 4 }, "end": { "line": 47, "column": 80 } } }, { "type": "ReturnStatement", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2103, 2107 ], "loc": { "start": { "line": 48, "column": 11 }, "end": { "line": 48, "column": 15 } } }, "property": { "type": "Identifier", "name": "lift", "range": [ 2108, 2112 ], "loc": { "start": { "line": 48, "column": 16 }, "end": { "line": 48, "column": 20 } } }, "range": [ 2103, 2112 ], "loc": { "start": { "line": 48, "column": 11 }, "end": { "line": 48, "column": 20 } } }, "arguments": [ { "type": "NewExpression", "callee": { "type": "Identifier", "name": "DelayOperator", "range": [ 2117, 2130 ], "loc": { "start": { "line": 48, "column": 25 }, "end": { "line": 48, "column": 38 } } }, "arguments": [ { "type": "Identifier", "name": "delayFor", "range": [ 2131, 2139 ], "loc": { "start": { "line": 48, "column": 39 }, "end": { "line": 48, "column": 47 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 2141, 2150 ], "loc": { "start": { "line": 48, "column": 49 }, "end": { "line": 48, "column": 58 } } } ], "range": [ 2113, 2151 ], "loc": { "start": { "line": 48, "column": 21 }, "end": { "line": 48, "column": 59 } } } ], "range": [ 2103, 2152 ], "loc": { "start": { "line": 48, "column": 11 }, "end": { "line": 48, "column": 60 } } }, "range": [ 2096, 2153 ], "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 48, "column": 61 } } } ], "range": [ 1917, 2155 ], "loc": { "start": { "line": 44, "column": 40 }, "end": { "line": 49, "column": 1 } } }, "generator": false, "expression": false, "range": [ 1884, 2155 ], "loc": { "start": { "line": 44, "column": 7 }, "end": { "line": 49, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Delays the emission of items from the source Observable by a given timeout or\n * until a given Date.\n *\n * <span class=\"informal\">Time shifts each item by some specified amount of\n * milliseconds.</span>\n *\n * <img src=\"./img/delay.png\" width=\"100%\">\n *\n * If the delay argument is a Number, this operator time shifts the source\n * Observable by that amount of time expressed in milliseconds. The relative\n * time intervals between the values are preserved.\n *\n * If the delay argument is a Date, this operator time shifts the start of the\n * Observable execution until the given date occurs.\n *\n * @example <caption>Delay each click by one second</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second\n * delayedClicks.subscribe(x => console.log(x));\n *\n * @example <caption>Delay all clicks until a future date happens</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var date = new Date('March 15, 2050 12:00:00'); // in the future\n * var delayedClicks = clicks.delay(date); // click emitted only after that date\n * delayedClicks.subscribe(x => console.log(x));\n *\n * @see {@link debounceTime}\n * @see {@link delayWhen}\n *\n * @param {number|Date} delay The delay duration in milliseconds (a `number`) or\n * a `Date` until which the emission of the source items is delayed.\n * @param {Scheduler} [scheduler=async] The Scheduler to use for\n * managing the timers that handle the time-shift for each item.\n * @return {Observable} An Observable that delays the emissions of the source\n * Observable by the specified timeout or Date.\n * @method delay\n * @owner Observable\n ", "range": [ 177, 1876 ], "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 43, "column": 3 } } } ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ 1877, 2155 ], "loc": { "start": { "line": 44, "column": 0 }, "end": { "line": 49, "column": 1 } }, "leadingComments": [ { "type": "Block", "value": "*\n * Delays the emission of items from the source Observable by a given timeout or\n * until a given Date.\n *\n * <span class=\"informal\">Time shifts each item by some specified amount of\n * milliseconds.</span>\n *\n * <img src=\"./img/delay.png\" width=\"100%\">\n *\n * If the delay argument is a Number, this operator time shifts the source\n * Observable by that amount of time expressed in milliseconds. The relative\n * time intervals between the values are preserved.\n *\n * If the delay argument is a Date, this operator time shifts the start of the\n * Observable execution until the given date occurs.\n *\n * @example <caption>Delay each click by one second</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second\n * delayedClicks.subscribe(x => console.log(x));\n *\n * @example <caption>Delay all clicks until a future date happens</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var date = new Date('March 15, 2050 12:00:00'); // in the future\n * var delayedClicks = clicks.delay(date); // click emitted only after that date\n * delayedClicks.subscribe(x => console.log(x));\n *\n * @see {@link debounceTime}\n * @see {@link delayWhen}\n *\n * @param {number|Date} delay The delay duration in milliseconds (a `number`) or\n * a `Date` until which the emission of the source items is delayed.\n * @param {Scheduler} [scheduler=async] The Scheduler to use for\n * managing the timers that handle the time-shift for each item.\n * @return {Observable} An Observable that delays the emissions of the source\n * Observable by the specified timeout or Date.\n * @method delay\n * @owner Observable\n ", "range": [ 177, 1876 ], "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 43, "column": 3 } } } ] }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "DelayOperator", "range": [ 2160, 2173 ], "loc": { "start": { "line": 50, "column": 4 }, "end": { "line": 50, "column": 17 } } }, "init": { "type": "CallExpression", "callee": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "FunctionDeclaration", "id": { "type": "Identifier", "name": "DelayOperator", "range": [ 2204, 2217 ], "loc": { "start": { "line": 51, "column": 13 }, "end": { "line": 51, "column": 26 } } }, "params": [ { "type": "Identifier", "name": "delay", "range": [ 2218, 2223 ], "loc": { "start": { "line": 51, "column": 27 }, "end": { "line": 51, "column": 32 } } }, { "type": "Identifier", "name": "scheduler", "range": [ 2225, 2234 ], "loc": { "start": { "line": 51, "column": 34 }, "end": { "line": 51, "column": 43 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2246, 2250 ], "loc": { "start": { "line": 52, "column": 8 }, "end": { "line": 52, "column": 12 } } }, "property": { "type": "Identifier", "name": "delay", "range": [ 2251, 2256 ], "loc": { "start": { "line": 52, "column": 13 }, "end": { "line": 52, "column": 18 } } }, "range": [ 2246, 2256 ], "loc": { "start": { "line": 52, "column": 8 }, "end": { "line": 52, "column": 18 } } }, "right": { "type": "Identifier", "name": "delay", "range": [ 2259, 2264 ], "loc": { "start": { "line": 52, "column": 21 }, "end": { "line": 52, "column": 26 } } }, "range": [ 2246, 2264 ], "loc": { "start": { "line": 52, "column": 8 }, "end": { "line": 52, "column": 26 } } }, "range": [ 2246, 2265 ], "loc": { "start": { "line": 52, "column": 8 }, "end": { "line": 52, "column": 27 } } }, { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 2274, 2278 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 12 } } }, "property": { "type": "Identifier", "name": "scheduler", "range": [ 2279, 2288 ], "loc": { "start": { "line": 53, "column": 13 }, "end": { "line": 53, "column": 22 } } }, "range": [ 2274, 2288 ], "loc": { "start": { "line": 53, "column": 8 }, "end": { "line": 53, "column": 22 } } }, "right": { "type": "Identifier", "name": "scheduler", "range": [ 2291, 2300 ], "loc": { "start": { "line": 53, "column": 25 },