@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,573 lines (1,572 loc) • 268 kB
JSON
{
"type": "Program",
"body": [
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "Subscription",
"range": [
9,
21
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 21
}
}
},
"imported": {
"type": "Identifier",
"name": "Subscription",
"range": [
9,
21
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 21
}
}
},
"range": [
9,
21
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 21
}
}
}
],
"source": {
"type": "Literal",
"value": "../Subscription",
"raw": "'../Subscription'",
"range": [
29,
46
],
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 46
}
}
},
"range": [
0,
47
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 47
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "tryCatch",
"range": [
57,
65
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 17
}
}
},
"imported": {
"type": "Identifier",
"name": "tryCatch",
"range": [
57,
65
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 17
}
}
},
"range": [
57,
65
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 17
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/tryCatch",
"raw": "'../util/tryCatch'",
"range": [
73,
91
],
"loc": {
"start": {
"line": 2,
"column": 25
},
"end": {
"line": 2,
"column": 43
}
}
},
"range": [
48,
92
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 44
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "errorObject",
"range": [
102,
113
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 20
}
}
},
"imported": {
"type": "Identifier",
"name": "errorObject",
"range": [
102,
113
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 20
}
}
},
"range": [
102,
113
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 20
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/errorObject",
"raw": "'../util/errorObject'",
"range": [
121,
142
],
"loc": {
"start": {
"line": 3,
"column": 28
},
"end": {
"line": 3,
"column": 49
}
}
},
"range": [
93,
143
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 50
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "OuterSubscriber",
"range": [
153,
168
],
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 24
}
}
},
"imported": {
"type": "Identifier",
"name": "OuterSubscriber",
"range": [
153,
168
],
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 24
}
}
},
"range": [
153,
168
],
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 24
}
}
}
],
"source": {
"type": "Literal",
"value": "../OuterSubscriber",
"raw": "'../OuterSubscriber'",
"range": [
176,
196
],
"loc": {
"start": {
"line": 4,
"column": 32
},
"end": {
"line": 4,
"column": 52
}
}
},
"range": [
144,
197
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 53
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "subscribeToResult",
"range": [
207,
224
],
"loc": {
"start": {
"line": 5,
"column": 9
},
"end": {
"line": 5,
"column": 26
}
}
},
"imported": {
"type": "Identifier",
"name": "subscribeToResult",
"range": [
207,
224
],
"loc": {
"start": {
"line": 5,
"column": 9
},
"end": {
"line": 5,
"column": 26
}
}
},
"range": [
207,
224
],
"loc": {
"start": {
"line": 5,
"column": 9
},
"end": {
"line": 5,
"column": 26
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/subscribeToResult",
"raw": "'../util/subscribeToResult'",
"range": [
232,
259
],
"loc": {
"start": {
"line": 5,
"column": 34
},
"end": {
"line": 5,
"column": 61
}
}
},
"range": [
198,
260
],
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 5,
"column": 62
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Buffers the source Observable values, using a factory function of closing\n * Observables to determine when to close, emit, and reset the buffer.\n *\n * <span class=\"informal\">Collects values from the past as an array. When it\n * starts collecting values, it calls a function that returns an Observable that\n * tells when to close the buffer and restart collecting.</span>\n *\n * <img src=\"./img/bufferWhen.png\" width=\"100%\">\n *\n * Opens a buffer immediately, then closes the buffer when the observable\n * returned by calling `closingSelector` function emits a value. When it closes\n * the buffer, it immediately opens a new buffer and repeats the process.\n *\n * @example <caption>Emit an array of the last clicks every [1-5] random seconds</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var buffered = clicks.bufferWhen(() =>\n * Rx.Observable.interval(1000 + Math.random() * 4000)\n * );\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link windowWhen}\n *\n * @param {function(): Observable} closingSelector A function that takes no\n * arguments and returns an Observable that signals buffer closure.\n * @return {Observable<T[]>} An observable of arrays of buffered values.\n * @method bufferWhen\n * @owner Observable\n ",
"range": [
261,
1628
],
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 38,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "bufferWhen",
"range": [
1645,
1655
],
"loc": {
"start": {
"line": 39,
"column": 16
},
"end": {
"line": 39,
"column": 26
}
}
},
"params": [
{
"type": "Identifier",
"name": "closingSelector",
"range": [
1656,
1671
],
"loc": {
"start": {
"line": 39,
"column": 27
},
"end": {
"line": 39,
"column": 42
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1686,
1690
],
"loc": {
"start": {
"line": 40,
"column": 11
},
"end": {
"line": 40,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
1691,
1695
],
"loc": {
"start": {
"line": 40,
"column": 16
},
"end": {
"line": 40,
"column": 20
}
}
},
"range": [
1686,
1695
],
"loc": {
"start": {
"line": 40,
"column": 11
},
"end": {
"line": 40,
"column": 20
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "BufferWhenOperator",
"range": [
1700,
1718
],
"loc": {
"start": {
"line": 40,
"column": 25
},
"end": {
"line": 40,
"column": 43
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "closingSelector",
"range": [
1719,
1734
],
"loc": {
"start": {
"line": 40,
"column": 44
},
"end": {
"line": 40,
"column": 59
}
}
}
],
"range": [
1696,
1735
],
"loc": {
"start": {
"line": 40,
"column": 21
},
"end": {
"line": 40,
"column": 60
}
}
}
],
"range": [
1686,
1736
],
"loc": {
"start": {
"line": 40,
"column": 11
},
"end": {
"line": 40,
"column": 61
}
}
},
"range": [
1679,
1737
],
"loc": {
"start": {
"line": 40,
"column": 4
},
"end": {
"line": 40,
"column": 62
}
}
}
],
"range": [
1673,
1739
],
"loc": {
"start": {
"line": 39,
"column": 44
},
"end": {
"line": 41,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1636,
1739
],
"loc": {
"start": {
"line": 39,
"column": 7
},
"end": {
"line": 41,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Buffers the source Observable values, using a factory function of closing\n * Observables to determine when to close, emit, and reset the buffer.\n *\n * <span class=\"informal\">Collects values from the past as an array. When it\n * starts collecting values, it calls a function that returns an Observable that\n * tells when to close the buffer and restart collecting.</span>\n *\n * <img src=\"./img/bufferWhen.png\" width=\"100%\">\n *\n * Opens a buffer immediately, then closes the buffer when the observable\n * returned by calling `closingSelector` function emits a value. When it closes\n * the buffer, it immediately opens a new buffer and repeats the process.\n *\n * @example <caption>Emit an array of the last clicks every [1-5] random seconds</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var buffered = clicks.bufferWhen(() =>\n * Rx.Observable.interval(1000 + Math.random() * 4000)\n * );\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link windowWhen}\n *\n * @param {function(): Observable} closingSelector A function that takes no\n * arguments and returns an Observable that signals buffer closure.\n * @return {Observable<T[]>} An observable of arrays of buffered values.\n * @method bufferWhen\n * @owner Observable\n ",
"range": [
261,
1628
],
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 38,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
1629,
1739
],
"loc": {
"start": {
"line": 39,
"column": 0
},
"end": {
"line": 41,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Buffers the source Observable values, using a factory function of closing\n * Observables to determine when to close, emit, and reset the buffer.\n *\n * <span class=\"informal\">Collects values from the past as an array. When it\n * starts collecting values, it calls a function that returns an Observable that\n * tells when to close the buffer and restart collecting.</span>\n *\n * <img src=\"./img/bufferWhen.png\" width=\"100%\">\n *\n * Opens a buffer immediately, then closes the buffer when the observable\n * returned by calling `closingSelector` function emits a value. When it closes\n * the buffer, it immediately opens a new buffer and repeats the process.\n *\n * @example <caption>Emit an array of the last clicks every [1-5] random seconds</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var buffered = clicks.bufferWhen(() =>\n * Rx.Observable.interval(1000 + Math.random() * 4000)\n * );\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferToggle}\n * @see {@link windowWhen}\n *\n * @param {function(): Observable} closingSelector A function that takes no\n * arguments and returns an Observable that signals buffer closure.\n * @return {Observable<T[]>} An observable of arrays of buffered values.\n * @method bufferWhen\n * @owner Observable\n ",
"range": [
261,
1628
],
"loc": {
"start": {
"line": 6,
"column": 0
},
"end": {
"line": 38,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "BufferWhenOperator",
"range": [
1744,
1762
],
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 42,
"column": 22
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "BufferWhenOperator",
"range": [
1793,
1811
],
"loc": {
"start": {
"line": 43,
"column": 13
},
"end": {
"line": 43,
"column": 31
}
}
},
"params": [
{
"type": "Identifier",
"name": "closingSelector",
"range": [
1812,
1827
],
"loc": {
"start": {
"line": 43,
"column": 32
},
"end": {
"line": 43,
"column": 47
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1839,
1843
],
"loc": {
"start": {
"line": 44,
"column": 8
},
"end": {
"line": 44,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "closingSelector",
"range": [
1844,
1859
],
"loc": {
"start": {
"line": 44,
"column": 13
},
"end": {
"line": 44,
"column": 28
}
}
},
"range": [
1839,
1859
],
"loc": {
"start": {
"line": 44,
"column": 8
},
"end": {
"line": 44,
"column": 28
}
}
},
"right": {
"type": "Identifier",
"name": "closingSelector",
"range": [
1862,
1877
],
"loc": {
"start": {
"line": 44,
"column": 31
},
"end": {
"line": 44,
"column": 46
}
}
},
"range": [
1839,
1877
],
"loc": {
"start": {
"line": 44,
"column": 8
},
"end": {
"line": 44,
"column": 46
}
}
},
"range": [
1839,
1878
],
"loc": {
"start": {
"line": 44,
"column": 8
},
"end": {
"line": 44,
"column": 47
}
}
}
],
"range": [
1829,
1884
],
"loc": {
"start": {
"line": 43,
"column": 49
},
"end": {
"line": 45,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
1784,
1884
],
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 45,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "BufferWhenOperator",
"range": [
1889,
1907
],
"loc": {
"start": {
"line": 46,
"column": 4
},
"end": {
"line": 46,
"column": 22
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
1908,
1917
],
"loc": {
"start": {
"line": 46,
"column": 23
},
"end": {
"line": 46,
"column": 32
}
}
},
"range": [
1889,
1917
],
"loc": {
"start": {
"line": 46,
"column": 4
},
"end": {
"line": 46,
"column": 32
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
1918,
1922
],
"loc": {
"start": {
"line": 46,
"column": 33
},
"end": {
"line": 46,
"column": 37
}
}
},
"range": [
1889,
1922
],
"loc": {
"start": {
"line": 46,
"column": 4
},
"end": {
"line": 46,
"column": 37
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
1935,
1945
],
"loc": {
"start": {
"line": 46,
"column": 50
},
"end": {
"line": 46,
"column": 60
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
1947,
1953
],
"loc": {
"start": {
"line": 46,
"column": 62
},
"end": {
"line": 46,
"column": 68
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
1972,
1978
],
"loc": {
"start": {
"line": 47,
"column": 15
},
"end": {
"line": 47,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
1979,
1989
],
"loc": {
"start": {
"line": 47,
"column": 22
},
"end": {
"line": 47,
"column": 32
}
}
},
"range": [
1972,
1989
],
"loc": {
"start": {
"line": 47,
"column": 15
},
"end": {
"line": 47,
"column": 32
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "BufferWhenSubscriber",
"range": [
1994,
2014
],
"loc": {
"start": {
"line": 47,
"column": 37
},
"end": {
"line": 47,
"column": 57
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2015,
2025
],
"loc": {
"start": {
"line": 47,
"column": 58
},
"end": {
"line": 47,
"column": 68
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2027,
2031
],
"loc": {
"start": {
"line": 47,
"column": 70
},
"end": {
"line": 47,
"column": 74
}
}
},
"property": {
"type": "Identifier",
"name": "closingSelector",
"range": [
2032,
2047
],
"loc": {
"start": {
"line": 47,
"column": 75
},
"end": {
"line": 47,
"column": 90
}
}
},
"range": [
2027,
2047
],
"loc": {
"start": {
"line": 47,
"column": 70
},
"end": {
"line": 47,
"column": 90
}
}
}
],
"range": [
1990,
2048
],
"loc": {
"start": {
"line": 47,
"column": 33
},
"end": {
"line": 47,
"column": 91
}
}
}
],
"range": [
1972,
2049
],
"loc": {
"start": {
"line": 47,
"column": 15
},
"end": {
"line": 47,
"column": 92
}
}
},
"range": [
1965,
2050
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 93
}
}
}
],
"range": [
1955,
2056
],
"loc": {
"start": {
"line": 46,
"column": 70
},
"end": {
"line": 48,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
1925,
2056
],
"loc": {
"start": {
"line": 46,
"column": 40
},
"end": {
"line": 48,
"column": 5
}
}
},
"range": [
1889,
2056
],
"loc": {
"start": {
"line": 46,
"column": 4
},
"end": {
"line": 48,
"column": 5
}
}
},
"range": [
1889,
2057
],
"loc": {
"start": {
"line": 46,
"column": 4
},
"end": {
"line": 48,
"column": 6
}
}
},
{
"type": "ReturnStatement",
"argument": {
"type": "Identifier",
"name": "BufferWhenOperator",
"range": [
2069,
2087
],
"loc": {
"start": {
"line": 49,
"column": 11
},
"end": {
"line": 49,
"column": 29
}
}
},
"range": [
2062,
2088
],
"loc": {
"start": {
"line": 49,
"column": 4
},
"end": {
"line": 49,
"column": 30
}
}
}
],
"range": [
1778,
2090
],
"loc": {
"start": {
"line": 42,
"column": 38
},
"end": {
"line": 50,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1766,
2090
],
"loc": {
"start": {
"line": 42,
"column": 26
},
"end": {
"line": 50,
"column": 1
}
}
},
"arguments": [],
"range": [
1766,
2092
],
"loc": {
"start": {
"line": 42,
"column": 26
},
"end": {
"line": 50,
"column": 3
}
}
},
"range": [
1744,
2093
],
"loc": {
"start": {
"line": 42,
"column": 4
},
"end": {
"line": 50,
"column": 4
}
}
}
],
"kind": "var",
"range": [
1740,
2094
],
"loc": {
"start": {
"line": 42,
"column": 0
},
"end": {
"line": 50,
"column": 5
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * We need this JSDoc comment for affecting ESDoc.\n * @ignore\n * @extends {Ignored}\n ",
"range": [
2095,
2186
],
"loc": {
"start": {
"line": 51,
"column": 0
},
"end": {
"line": 55,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "BufferWhenSubscriber",
"range": [
2191,
2211
],
"loc": {
"start": {
"line": 56,
"column": 4
},
"end": {
"line": 56,
"column": 24
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "_super",
"range": [
2225,
2231
],
"loc": {
"start": {
"line": 56,
"column": 38
},
"end": {
"line": 56,
"column": 44
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "__extends",
"range": [
2239,
2248
],
"loc": {
"start": {