@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,386 lines (1,385 loc) • 159 kB
JSON
{
"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
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "async",
"range": [
53,
58
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
}
},
"imported": {
"type": "Identifier",
"name": "async",
"range": [
53,
58
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
}
},
"range": [
53,
58
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
}
}
],
"source": {
"type": "Literal",
"value": "../scheduler/async",
"raw": "'../scheduler/async'",
"range": [
66,
86
],
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 42
}
}
},
"range": [
44,
87
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 43
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Emits the most recently emitted value from the source Observable within\n * periodic time intervals.\n *\n * <span class=\"informal\">Samples the source Observable at periodic time\n * intervals, emitting what it samples.</span>\n *\n * <img src=\"./img/sampleTime.png\" width=\"100%\">\n *\n * `sampleTime` periodically looks at the source Observable and emits whichever\n * value it has most recently emitted since the previous sampling, unless the\n * source has not emitted anything since the previous sampling. The sampling\n * happens periodically in time every `period` milliseconds (or the time unit\n * defined by the optional `scheduler` argument). The sampling starts as soon as\n * the output Observable is subscribed.\n *\n * @example <caption>Every second, emit the most recent click at most once</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.sampleTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sample}\n * @see {@link throttleTime}\n *\n * @param {number} period The sampling period expressed in milliseconds or the\n * time unit determined internally by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the sampling.\n * @return {Observable<T>} An Observable that emits the results of sampling the\n * values emitted by the source Observable at the specified time interval.\n * @method sampleTime\n * @owner Observable\n ",
"range": [
88,
1639
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 38,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "sampleTime",
"range": [
1656,
1666
],
"loc": {
"start": {
"line": 39,
"column": 16
},
"end": {
"line": 39,
"column": 26
}
}
},
"params": [
{
"type": "Identifier",
"name": "period",
"range": [
1667,
1673
],
"loc": {
"start": {
"line": 39,
"column": 27
},
"end": {
"line": 39,
"column": 33
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
1675,
1684
],
"loc": {
"start": {
"line": 39,
"column": 35
},
"end": {
"line": 39,
"column": 44
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "IfStatement",
"test": {
"type": "BinaryExpression",
"operator": "===",
"left": {
"type": "Identifier",
"name": "scheduler",
"range": [
1696,
1705
],
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 17
}
}
},
"right": {
"type": "UnaryExpression",
"operator": "void",
"argument": {
"type": "Literal",
"value": 0,
"raw": "0",
"range": [
1715,
1716
],
"loc": {
"start": {
"line": 40,
"column": 27
},
"end": {
"line": 40,
"column": 28
}
}
},
"prefix": true,
"range": [
1710,
1716
],
"loc": {
"start": {
"line": 40,
"column": 22
},
"end": {
"line": 40,
"column": 28
}
}
},
"range": [
1696,
1716
],
"loc": {
"start": {
"line": 40,
"column": 8
},
"end": {
"line": 40,
"column": 28
}
}
},
"consequent": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "Identifier",
"name": "scheduler",
"range": [
1720,
1729
],
"loc": {
"start": {
"line": 40,
"column": 32
},
"end": {
"line": 40,
"column": 41
}
}
},
"right": {
"type": "Identifier",
"name": "async",
"range": [
1732,
1737
],
"loc": {
"start": {
"line": 40,
"column": 44
},
"end": {
"line": 40,
"column": 49
}
}
},
"range": [
1720,
1737
],
"loc": {
"start": {
"line": 40,
"column": 32
},
"end": {
"line": 40,
"column": 49
}
}
},
"range": [
1720,
1738
],
"loc": {
"start": {
"line": 40,
"column": 32
},
"end": {
"line": 40,
"column": 50
}
}
}
],
"range": [
1718,
1740
],
"loc": {
"start": {
"line": 40,
"column": 30
},
"end": {
"line": 40,
"column": 52
}
}
},
"alternate": null,
"range": [
1692,
1740
],
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 40,
"column": 52
}
}
},
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1752,
1756
],
"loc": {
"start": {
"line": 41,
"column": 11
},
"end": {
"line": 41,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
1757,
1761
],
"loc": {
"start": {
"line": 41,
"column": 16
},
"end": {
"line": 41,
"column": 20
}
}
},
"range": [
1752,
1761
],
"loc": {
"start": {
"line": 41,
"column": 11
},
"end": {
"line": 41,
"column": 20
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "SampleTimeOperator",
"range": [
1766,
1784
],
"loc": {
"start": {
"line": 41,
"column": 25
},
"end": {
"line": 41,
"column": 43
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "period",
"range": [
1785,
1791
],
"loc": {
"start": {
"line": 41,
"column": 44
},
"end": {
"line": 41,
"column": 50
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
1793,
1802
],
"loc": {
"start": {
"line": 41,
"column": 52
},
"end": {
"line": 41,
"column": 61
}
}
}
],
"range": [
1762,
1803
],
"loc": {
"start": {
"line": 41,
"column": 21
},
"end": {
"line": 41,
"column": 62
}
}
}
],
"range": [
1752,
1804
],
"loc": {
"start": {
"line": 41,
"column": 11
},
"end": {
"line": 41,
"column": 63
}
}
},
"range": [
1745,
1805
],
"loc": {
"start": {
"line": 41,
"column": 4
},
"end": {
"line": 41,
"column": 64
}
}
}
],
"range": [
1686,
1807
],
"loc": {
"start": {
"line": 39,
"column": 46
},
"end": {
"line": 42,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1647,
1807
],
"loc": {
"start": {
"line": 39,
"column": 7
},
"end": {
"line": 42,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits the most recently emitted value from the source Observable within\n * periodic time intervals.\n *\n * <span class=\"informal\">Samples the source Observable at periodic time\n * intervals, emitting what it samples.</span>\n *\n * <img src=\"./img/sampleTime.png\" width=\"100%\">\n *\n * `sampleTime` periodically looks at the source Observable and emits whichever\n * value it has most recently emitted since the previous sampling, unless the\n * source has not emitted anything since the previous sampling. The sampling\n * happens periodically in time every `period` milliseconds (or the time unit\n * defined by the optional `scheduler` argument). The sampling starts as soon as\n * the output Observable is subscribed.\n *\n * @example <caption>Every second, emit the most recent click at most once</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.sampleTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sample}\n * @see {@link throttleTime}\n *\n * @param {number} period The sampling period expressed in milliseconds or the\n * time unit determined internally by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the sampling.\n * @return {Observable<T>} An Observable that emits the results of sampling the\n * values emitted by the source Observable at the specified time interval.\n * @method sampleTime\n * @owner Observable\n ",
"range": [
88,
1639
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 38,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
1640,
1807
],
"loc": {
"start": {
"line": 39,
"column": 0
},
"end": {
"line": 42,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits the most recently emitted value from the source Observable within\n * periodic time intervals.\n *\n * <span class=\"informal\">Samples the source Observable at periodic time\n * intervals, emitting what it samples.</span>\n *\n * <img src=\"./img/sampleTime.png\" width=\"100%\">\n *\n * `sampleTime` periodically looks at the source Observable and emits whichever\n * value it has most recently emitted since the previous sampling, unless the\n * source has not emitted anything since the previous sampling. The sampling\n * happens periodically in time every `period` milliseconds (or the time unit\n * defined by the optional `scheduler` argument). The sampling starts as soon as\n * the output Observable is subscribed.\n *\n * @example <caption>Every second, emit the most recent click at most once</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.sampleTime(1000);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link auditTime}\n * @see {@link debounceTime}\n * @see {@link delay}\n * @see {@link sample}\n * @see {@link throttleTime}\n *\n * @param {number} period The sampling period expressed in milliseconds or the\n * time unit determined internally by the optional `scheduler`.\n * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for\n * managing the timers that handle the sampling.\n * @return {Observable<T>} An Observable that emits the results of sampling the\n * values emitted by the source Observable at the specified time interval.\n * @method sampleTime\n * @owner Observable\n ",
"range": [
88,
1639
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 38,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "SampleTimeOperator",
"range": [
1812,
1830
],
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 22
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "SampleTimeOperator",
"range": [
1861,
1879
],
"loc": {
"start": {
"line": 44,
"column": 13
},
"end": {
"line": 44,
"column": 31
}
}
},
"params": [
{
"type": "Identifier",
"name": "period",
"range": [
1880,
1886
],
"loc": {
"start": {
"line": 44,
"column": 32
},
"end": {
"line": 44,
"column": 38
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
1888,
1897
],
"loc": {
"start": {
"line": 44,
"column": 40
},
"end": {
"line": 44,
"column": 49
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1909,
1913
],
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "period",
"range": [
1914,
1920
],
"loc": {
"start": {
"line": 45,
"column": 13
},
"end": {
"line": 45,
"column": 19
}
}
},
"range": [
1909,
1920
],
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 19
}
}
},
"right": {
"type": "Identifier",
"name": "period",
"range": [
1923,
1929
],
"loc": {
"start": {
"line": 45,
"column": 22
},
"end": {
"line": 45,
"column": 28
}
}
},
"range": [
1909,
1929
],
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 28
}
}
},
"range": [
1909,
1930
],
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 29
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1939,
1943
],
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "scheduler",
"range": [
1944,
1953
],
"loc": {
"start": {
"line": 46,
"column": 13
},
"end": {
"line": 46,
"column": 22
}
}
},
"range": [
1939,
1953
],
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 22
}
}
},
"right": {
"type": "Identifier",
"name": "scheduler",
"range": [
1956,
1965
],
"loc": {
"start": {
"line": 46,
"column": 25
},
"end": {
"line": 46,
"column": 34
}
}
},
"range": [
1939,
1965
],
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 34
}
}
},
"range": [
1939,
1966
],
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 35
}
}
}
],
"range": [
1899,
1972
],
"loc": {
"start": {
"line": 44,
"column": 51
},
"end": {
"line": 47,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
1852,
1972
],
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 47,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "SampleTimeOperator",
"range": [
1977,
1995
],
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 48,
"column": 22
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
1996,
2005
],
"loc": {
"start": {
"line": 48,
"column": 23
},
"end": {
"line": 48,
"column": 32
}
}
},
"range": [
1977,
2005
],
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 48,
"column": 32
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
2006,
2010
],
"loc": {
"start": {
"line": 48,
"column": 33
},
"end": {
"line": 48,
"column": 37
}
}
},
"range": [
1977,
2010
],
"loc": {
"start": {
"line": 48,
"column": 4
},
"end": {
"line": 48,
"column": 37
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2023,
2033
],
"loc": {
"start": {
"line": 48,
"column": 50
},
"end": {
"line": 48,
"column": 60
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
2035,
2041
],
"loc": {
"start": {
"line": 48,
"column": 62
},
"end": {
"line": 48,
"column": 68
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
2060,
2066
],
"loc": {
"start": {
"line": 49,
"column": 15
},
"end": {
"line": 49,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
2067,
2077
],
"loc": {
"start": {
"line": 49,
"column": 22
},
"end": {
"line": 49,
"column": 32
}
}
},
"range": [
2060,
2077
],
"loc": {
"start": {
"line": 49,
"column": 15
},
"end": {
"line": 49,
"column": 32
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "SampleTimeSubscriber",
"range": [
2082,
2102
],
"loc": {
"start": {
"line": 49,
"column": 37
},
"end": {
"line": 49,
"column": 57
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2103,
2113
],
"loc": {
"start": {
"line": 49,
"column": 58
},
"end": {
"line": 49,
"column": 68
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2115,
2119
],
"loc": {
"start": {
"line": 49,
"column": 70
},
"end": {
"line": 49,
"column": 74
}
}
},
"property": {
"type": "Identifier",
"name": "period",
"range": [
2120,
2126
],
"loc": {
"start": {
"line": 49,
"column": 75
},
"end": {
"line": 49,
"column": 81
}
}
},
"range": [
2115,
2126
],
"loc": {
"start": {
"line": 49,
"column": 70
},
"end": {
"line": 49,
"column": 81
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2128,
2132
],
"loc": {
"start": {
"line": 49,
"column": 83
},
"end": {
"line": 49,
"column": 87
}
}
},
"property": {
"type": "Identifier",
"name": "scheduler",
"range": [
2133,
2142
],
"loc": {
"start": {
"line": 49,
"column": 88
},
"end": {
"line": 49,
"column": 97
}
}
},
"range": [
2128,
2142
],
"loc": {
"start": {
"line": 49,
"column": 83
},
"end": {
"line": 49,
"column": 97
}
}
}
],