@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,308 lines (1,307 loc) • 142 kB
JSON
{
"type": "Program",
"body": [
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "OuterSubscriber",
"range": [
9,
24
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 24
}
}
},
"imported": {
"type": "Identifier",
"name": "OuterSubscriber",
"range": [
9,
24
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 24
}
}
},
"range": [
9,
24
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 24
}
}
}
],
"source": {
"type": "Literal",
"value": "../OuterSubscriber",
"raw": "'../OuterSubscriber'",
"range": [
32,
52
],
"loc": {
"start": {
"line": 1,
"column": 32
},
"end": {
"line": 1,
"column": 52
}
}
},
"range": [
0,
53
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 53
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "subscribeToResult",
"range": [
63,
80
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 26
}
}
},
"imported": {
"type": "Identifier",
"name": "subscribeToResult",
"range": [
63,
80
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 26
}
}
},
"range": [
63,
80
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 26
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/subscribeToResult",
"raw": "'../util/subscribeToResult'",
"range": [
88,
115
],
"loc": {
"start": {
"line": 2,
"column": 34
},
"end": {
"line": 2,
"column": 61
}
}
},
"range": [
54,
116
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 62
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Emits the most recently emitted value from the source Observable whenever\n * another Observable, the `notifier`, emits.\n *\n * <span class=\"informal\">It's like {@link sampleTime}, but samples whenever\n * the `notifier` Observable emits something.</span>\n *\n * <img src=\"./img/sample.png\" width=\"100%\">\n *\n * Whenever the `notifier` Observable emits a value or completes, `sample`\n * looks at the source Observable and emits whichever value it has most recently\n * emitted since the previous sampling, unless the source has not emitted\n * anything since the previous sampling. The `notifier` is subscribed to as soon\n * as the output Observable is subscribed.\n *\n * @example <caption>On every click, sample the most recent \"seconds\" timer</caption>\n * var seconds = Rx.Observable.interval(1000);\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = seconds.sample(clicks);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param {Observable<any>} notifier The Observable to use for sampling the\n * source Observable.\n * @return {Observable<T>} An Observable that emits the results of sampling the\n * values emitted by the source Observable whenever the notifier Observable\n * emits value or completes.\n * @method sample\n * @owner Observable\n ",
"range": [
117,
1490
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "sample",
"range": [
1507,
1513
],
"loc": {
"start": {
"line": 37,
"column": 16
},
"end": {
"line": 37,
"column": 22
}
}
},
"params": [
{
"type": "Identifier",
"name": "notifier",
"range": [
1514,
1522
],
"loc": {
"start": {
"line": 37,
"column": 23
},
"end": {
"line": 37,
"column": 31
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1537,
1541
],
"loc": {
"start": {
"line": 38,
"column": 11
},
"end": {
"line": 38,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
1542,
1546
],
"loc": {
"start": {
"line": 38,
"column": 16
},
"end": {
"line": 38,
"column": 20
}
}
},
"range": [
1537,
1546
],
"loc": {
"start": {
"line": 38,
"column": 11
},
"end": {
"line": 38,
"column": 20
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "SampleOperator",
"range": [
1551,
1565
],
"loc": {
"start": {
"line": 38,
"column": 25
},
"end": {
"line": 38,
"column": 39
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "notifier",
"range": [
1566,
1574
],
"loc": {
"start": {
"line": 38,
"column": 40
},
"end": {
"line": 38,
"column": 48
}
}
}
],
"range": [
1547,
1575
],
"loc": {
"start": {
"line": 38,
"column": 21
},
"end": {
"line": 38,
"column": 49
}
}
}
],
"range": [
1537,
1576
],
"loc": {
"start": {
"line": 38,
"column": 11
},
"end": {
"line": 38,
"column": 50
}
}
},
"range": [
1530,
1577
],
"loc": {
"start": {
"line": 38,
"column": 4
},
"end": {
"line": 38,
"column": 51
}
}
}
],
"range": [
1524,
1579
],
"loc": {
"start": {
"line": 37,
"column": 33
},
"end": {
"line": 39,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1498,
1579
],
"loc": {
"start": {
"line": 37,
"column": 7
},
"end": {
"line": 39,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits the most recently emitted value from the source Observable whenever\n * another Observable, the `notifier`, emits.\n *\n * <span class=\"informal\">It's like {@link sampleTime}, but samples whenever\n * the `notifier` Observable emits something.</span>\n *\n * <img src=\"./img/sample.png\" width=\"100%\">\n *\n * Whenever the `notifier` Observable emits a value or completes, `sample`\n * looks at the source Observable and emits whichever value it has most recently\n * emitted since the previous sampling, unless the source has not emitted\n * anything since the previous sampling. The `notifier` is subscribed to as soon\n * as the output Observable is subscribed.\n *\n * @example <caption>On every click, sample the most recent \"seconds\" timer</caption>\n * var seconds = Rx.Observable.interval(1000);\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = seconds.sample(clicks);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param {Observable<any>} notifier The Observable to use for sampling the\n * source Observable.\n * @return {Observable<T>} An Observable that emits the results of sampling the\n * values emitted by the source Observable whenever the notifier Observable\n * emits value or completes.\n * @method sample\n * @owner Observable\n ",
"range": [
117,
1490
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
1491,
1579
],
"loc": {
"start": {
"line": 37,
"column": 0
},
"end": {
"line": 39,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Emits the most recently emitted value from the source Observable whenever\n * another Observable, the `notifier`, emits.\n *\n * <span class=\"informal\">It's like {@link sampleTime}, but samples whenever\n * the `notifier` Observable emits something.</span>\n *\n * <img src=\"./img/sample.png\" width=\"100%\">\n *\n * Whenever the `notifier` Observable emits a value or completes, `sample`\n * looks at the source Observable and emits whichever value it has most recently\n * emitted since the previous sampling, unless the source has not emitted\n * anything since the previous sampling. The `notifier` is subscribed to as soon\n * as the output Observable is subscribed.\n *\n * @example <caption>On every click, sample the most recent \"seconds\" timer</caption>\n * var seconds = Rx.Observable.interval(1000);\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = seconds.sample(clicks);\n * result.subscribe(x => console.log(x));\n *\n * @see {@link audit}\n * @see {@link debounce}\n * @see {@link sampleTime}\n * @see {@link throttle}\n *\n * @param {Observable<any>} notifier The Observable to use for sampling the\n * source Observable.\n * @return {Observable<T>} An Observable that emits the results of sampling the\n * values emitted by the source Observable whenever the notifier Observable\n * emits value or completes.\n * @method sample\n * @owner Observable\n ",
"range": [
117,
1490
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "SampleOperator",
"range": [
1584,
1598
],
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 40,
"column": 18
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "SampleOperator",
"range": [
1629,
1643
],
"loc": {
"start": {
"line": 41,
"column": 13
},
"end": {
"line": 41,
"column": 27
}
}
},
"params": [
{
"type": "Identifier",
"name": "notifier",
"range": [
1644,
1652
],
"loc": {
"start": {
"line": 41,
"column": 28
},
"end": {
"line": 41,
"column": 36
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1664,
1668
],
"loc": {
"start": {
"line": 42,
"column": 8
},
"end": {
"line": 42,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "notifier",
"range": [
1669,
1677
],
"loc": {
"start": {
"line": 42,
"column": 13
},
"end": {
"line": 42,
"column": 21
}
}
},
"range": [
1664,
1677
],
"loc": {
"start": {
"line": 42,
"column": 8
},
"end": {
"line": 42,
"column": 21
}
}
},
"right": {
"type": "Identifier",
"name": "notifier",
"range": [
1680,
1688
],
"loc": {
"start": {
"line": 42,
"column": 24
},
"end": {
"line": 42,
"column": 32
}
}
},
"range": [
1664,
1688
],
"loc": {
"start": {
"line": 42,
"column": 8
},
"end": {
"line": 42,
"column": 32
}
}
},
"range": [
1664,
1689
],
"loc": {
"start": {
"line": 42,
"column": 8
},
"end": {
"line": 42,
"column": 33
}
}
}
],
"range": [
1654,
1695
],
"loc": {
"start": {
"line": 41,
"column": 38
},
"end": {
"line": 43,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
1620,
1695
],
"loc": {
"start": {
"line": 41,
"column": 4
},
"end": {
"line": 43,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "SampleOperator",
"range": [
1700,
1714
],
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 18
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
1715,
1724
],
"loc": {
"start": {
"line": 44,
"column": 19
},
"end": {
"line": 44,
"column": 28
}
}
},
"range": [
1700,
1724
],
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 28
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
1725,
1729
],
"loc": {
"start": {
"line": 44,
"column": 29
},
"end": {
"line": 44,
"column": 33
}
}
},
"range": [
1700,
1729
],
"loc": {
"start": {
"line": 44,
"column": 4
},
"end": {
"line": 44,
"column": 33
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
1742,
1752
],
"loc": {
"start": {
"line": 44,
"column": 46
},
"end": {
"line": 44,
"column": 56
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
1754,
1760
],
"loc": {
"start": {
"line": 44,
"column": 58
},
"end": {
"line": 44,
"column": 64
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "sampleSubscriber",
"range": [
1776,
1792
],
"loc": {
"start": {
"line": 45,
"column": 12
},
"end": {
"line": 45,
"column": 28
}
}
},
"init": {
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "SampleSubscriber",
"range": [
1799,
1815
],
"loc": {
"start": {
"line": 45,
"column": 35
},
"end": {
"line": 45,
"column": 51
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
1816,
1826
],
"loc": {
"start": {
"line": 45,
"column": 52
},
"end": {
"line": 45,
"column": 62
}
}
}
],
"range": [
1795,
1827
],
"loc": {
"start": {
"line": 45,
"column": 31
},
"end": {
"line": 45,
"column": 63
}
}
},
"range": [
1776,
1827
],
"loc": {
"start": {
"line": 45,
"column": 12
},
"end": {
"line": 45,
"column": 63
}
}
}
],
"kind": "var",
"range": [
1772,
1828
],
"loc": {
"start": {
"line": 45,
"column": 8
},
"end": {
"line": 45,
"column": 64
}
}
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "subscription",
"range": [
1841,
1853
],
"loc": {
"start": {
"line": 46,
"column": 12
},
"end": {
"line": 46,
"column": 24
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
1856,
1862
],
"loc": {
"start": {
"line": 46,
"column": 27
},
"end": {
"line": 46,
"column": 33
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
1863,
1873
],
"loc": {
"start": {
"line": 46,
"column": 34
},
"end": {
"line": 46,
"column": 44
}
}
},
"range": [
1856,
1873
],
"loc": {
"start": {
"line": 46,
"column": 27
},
"end": {
"line": 46,
"column": 44
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "sampleSubscriber",
"range": [
1874,
1890
],
"loc": {
"start": {
"line": 46,
"column": 45
},
"end": {
"line": 46,
"column": 61
}
}
}
],
"range": [
1856,
1891
],
"loc": {
"start": {
"line": 46,
"column": 27
},
"end": {
"line": 46,
"column": 62
}
}
},
"range": [
1841,
1891
],
"loc": {
"start": {
"line": 46,
"column": 12
},
"end": {
"line": 46,
"column": 62
}
}
}
],
"kind": "var",
"range": [
1837,
1892
],
"loc": {
"start": {
"line": 46,
"column": 8
},
"end": {
"line": 46,
"column": 63
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "subscription",
"range": [
1901,
1913
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 20
}
}
},
"property": {
"type": "Identifier",
"name": "add",
"range": [
1914,
1917
],
"loc": {
"start": {
"line": 47,
"column": 21
},
"end": {
"line": 47,
"column": 24
}
}
},
"range": [
1901,
1917
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 24
}
}
},
"arguments": [
{
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "subscribeToResult",
"range": [
1918,
1935
],
"loc": {
"start": {
"line": 47,
"column": 25
},
"end": {
"line": 47,
"column": 42
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "sampleSubscriber",
"range": [
1936,
1952
],
"loc": {
"start": {
"line": 47,
"column": 43
},
"end": {
"line": 47,
"column": 59
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1954,
1958
],
"loc": {
"start": {
"line": 47,
"column": 61
},
"end": {
"line": 47,
"column": 65
}
}
},
"property": {
"type": "Identifier",
"name": "notifier",
"range": [
1959,
1967
],
"loc": {
"start": {
"line": 47,
"column": 66
},
"end": {
"line": 47,
"column": 74
}
}
},
"range": [
1954,
1967
],
"loc": {
"start": {
"line": 47,
"column": 61
},
"end": {
"line": 47,
"column": 74
}
}
}
],
"range": [
1918,
1968
],
"loc": {
"start": {
"line": 47,
"column": 25
},
"end": {
"line": 47,
"column": 75
}
}
}
],
"range": [
1901,
1969
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 76
}
}
},
"range": [
1901,
1970
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 77
}
}
},
{
"type": "ReturnStatement",
"argument": {
"type": "Identifier",
"name": "subscription",
"range": [
1986,
1998
],
"loc": {
"start": {
"line": 48,
"column": 15
},
"end": {