@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,373 lines (1,372 loc) • 442 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": "subscribeToResult",
"range": [
57,
74
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 26
}
}
},
"imported": {
"type": "Identifier",
"name": "subscribeToResult",
"range": [
57,
74
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 26
}
}
},
"range": [
57,
74
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 26
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/subscribeToResult",
"raw": "'../util/subscribeToResult'",
"range": [
82,
109
],
"loc": {
"start": {
"line": 2,
"column": 34
},
"end": {
"line": 2,
"column": 61
}
}
},
"range": [
48,
110
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 62
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "OuterSubscriber",
"range": [
120,
135
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 24
}
}
},
"imported": {
"type": "Identifier",
"name": "OuterSubscriber",
"range": [
120,
135
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 24
}
}
},
"range": [
120,
135
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 24
}
}
}
],
"source": {
"type": "Literal",
"value": "../OuterSubscriber",
"raw": "'../OuterSubscriber'",
"range": [
143,
163
],
"loc": {
"start": {
"line": 3,
"column": 32
},
"end": {
"line": 3,
"column": 52
}
}
},
"range": [
111,
164
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 53
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Buffers the source Observable values starting from an emission from\n * `openings` and ending when the output of `closingSelector` emits.\n *\n * <span class=\"informal\">Collects values from the past as an array. Starts\n * collecting only when `opening` emits, and calls the `closingSelector`\n * function to get an Observable that tells when to close the buffer.</span>\n *\n * <img src=\"./img/bufferToggle.png\" width=\"100%\">\n *\n * Buffers values from the source by opening the buffer via signals from an\n * Observable provided to `openings`, and closing and sending the buffers when\n * a Subscribable or Promise returned by the `closingSelector` function emits.\n *\n * @example <caption>Every other second, emit the click events from the next 500ms</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var openings = Rx.Observable.interval(1000);\n * var buffered = clicks.bufferToggle(openings, i =>\n * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty()\n * );\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferWhen}\n * @see {@link windowToggle}\n *\n * @param {SubscribableOrPromise<O>} openings A Subscribable or Promise of notifications to start new\n * buffers.\n * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes\n * the value emitted by the `openings` observable and returns a Subscribable or Promise,\n * which, when it emits, signals that the associated buffer should be emitted\n * and cleared.\n * @return {Observable<T[]>} An observable of arrays of buffered values.\n * @method bufferToggle\n * @owner Observable\n ",
"range": [
165,
1851
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 41,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "bufferToggle",
"range": [
1868,
1880
],
"loc": {
"start": {
"line": 42,
"column": 16
},
"end": {
"line": 42,
"column": 28
}
}
},
"params": [
{
"type": "Identifier",
"name": "openings",
"range": [
1881,
1889
],
"loc": {
"start": {
"line": 42,
"column": 29
},
"end": {
"line": 42,
"column": 37
}
}
},
{
"type": "Identifier",
"name": "closingSelector",
"range": [
1891,
1906
],
"loc": {
"start": {
"line": 42,
"column": 39
},
"end": {
"line": 42,
"column": 54
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
1921,
1925
],
"loc": {
"start": {
"line": 43,
"column": 11
},
"end": {
"line": 43,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
1926,
1930
],
"loc": {
"start": {
"line": 43,
"column": 16
},
"end": {
"line": 43,
"column": 20
}
}
},
"range": [
1921,
1930
],
"loc": {
"start": {
"line": 43,
"column": 11
},
"end": {
"line": 43,
"column": 20
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "BufferToggleOperator",
"range": [
1935,
1955
],
"loc": {
"start": {
"line": 43,
"column": 25
},
"end": {
"line": 43,
"column": 45
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "openings",
"range": [
1956,
1964
],
"loc": {
"start": {
"line": 43,
"column": 46
},
"end": {
"line": 43,
"column": 54
}
}
},
{
"type": "Identifier",
"name": "closingSelector",
"range": [
1966,
1981
],
"loc": {
"start": {
"line": 43,
"column": 56
},
"end": {
"line": 43,
"column": 71
}
}
}
],
"range": [
1931,
1982
],
"loc": {
"start": {
"line": 43,
"column": 21
},
"end": {
"line": 43,
"column": 72
}
}
}
],
"range": [
1921,
1983
],
"loc": {
"start": {
"line": 43,
"column": 11
},
"end": {
"line": 43,
"column": 73
}
}
},
"range": [
1914,
1984
],
"loc": {
"start": {
"line": 43,
"column": 4
},
"end": {
"line": 43,
"column": 74
}
}
}
],
"range": [
1908,
1986
],
"loc": {
"start": {
"line": 42,
"column": 56
},
"end": {
"line": 44,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
1859,
1986
],
"loc": {
"start": {
"line": 42,
"column": 7
},
"end": {
"line": 44,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Buffers the source Observable values starting from an emission from\n * `openings` and ending when the output of `closingSelector` emits.\n *\n * <span class=\"informal\">Collects values from the past as an array. Starts\n * collecting only when `opening` emits, and calls the `closingSelector`\n * function to get an Observable that tells when to close the buffer.</span>\n *\n * <img src=\"./img/bufferToggle.png\" width=\"100%\">\n *\n * Buffers values from the source by opening the buffer via signals from an\n * Observable provided to `openings`, and closing and sending the buffers when\n * a Subscribable or Promise returned by the `closingSelector` function emits.\n *\n * @example <caption>Every other second, emit the click events from the next 500ms</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var openings = Rx.Observable.interval(1000);\n * var buffered = clicks.bufferToggle(openings, i =>\n * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty()\n * );\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferWhen}\n * @see {@link windowToggle}\n *\n * @param {SubscribableOrPromise<O>} openings A Subscribable or Promise of notifications to start new\n * buffers.\n * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes\n * the value emitted by the `openings` observable and returns a Subscribable or Promise,\n * which, when it emits, signals that the associated buffer should be emitted\n * and cleared.\n * @return {Observable<T[]>} An observable of arrays of buffered values.\n * @method bufferToggle\n * @owner Observable\n ",
"range": [
165,
1851
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 41,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
1852,
1986
],
"loc": {
"start": {
"line": 42,
"column": 0
},
"end": {
"line": 44,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Buffers the source Observable values starting from an emission from\n * `openings` and ending when the output of `closingSelector` emits.\n *\n * <span class=\"informal\">Collects values from the past as an array. Starts\n * collecting only when `opening` emits, and calls the `closingSelector`\n * function to get an Observable that tells when to close the buffer.</span>\n *\n * <img src=\"./img/bufferToggle.png\" width=\"100%\">\n *\n * Buffers values from the source by opening the buffer via signals from an\n * Observable provided to `openings`, and closing and sending the buffers when\n * a Subscribable or Promise returned by the `closingSelector` function emits.\n *\n * @example <caption>Every other second, emit the click events from the next 500ms</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var openings = Rx.Observable.interval(1000);\n * var buffered = clicks.bufferToggle(openings, i =>\n * i % 2 ? Rx.Observable.interval(500) : Rx.Observable.empty()\n * );\n * buffered.subscribe(x => console.log(x));\n *\n * @see {@link buffer}\n * @see {@link bufferCount}\n * @see {@link bufferTime}\n * @see {@link bufferWhen}\n * @see {@link windowToggle}\n *\n * @param {SubscribableOrPromise<O>} openings A Subscribable or Promise of notifications to start new\n * buffers.\n * @param {function(value: O): SubscribableOrPromise} closingSelector A function that takes\n * the value emitted by the `openings` observable and returns a Subscribable or Promise,\n * which, when it emits, signals that the associated buffer should be emitted\n * and cleared.\n * @return {Observable<T[]>} An observable of arrays of buffered values.\n * @method bufferToggle\n * @owner Observable\n ",
"range": [
165,
1851
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 41,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "BufferToggleOperator",
"range": [
1991,
2011
],
"loc": {
"start": {
"line": 45,
"column": 4
},
"end": {
"line": 45,
"column": 24
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "BufferToggleOperator",
"range": [
2042,
2062
],
"loc": {
"start": {
"line": 46,
"column": 13
},
"end": {
"line": 46,
"column": 33
}
}
},
"params": [
{
"type": "Identifier",
"name": "openings",
"range": [
2063,
2071
],
"loc": {
"start": {
"line": 46,
"column": 34
},
"end": {
"line": 46,
"column": 42
}
}
},
{
"type": "Identifier",
"name": "closingSelector",
"range": [
2073,
2088
],
"loc": {
"start": {
"line": 46,
"column": 44
},
"end": {
"line": 46,
"column": 59
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2100,
2104
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "openings",
"range": [
2105,
2113
],
"loc": {
"start": {
"line": 47,
"column": 13
},
"end": {
"line": 47,
"column": 21
}
}
},
"range": [
2100,
2113
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 21
}
}
},
"right": {
"type": "Identifier",
"name": "openings",
"range": [
2116,
2124
],
"loc": {
"start": {
"line": 47,
"column": 24
},
"end": {
"line": 47,
"column": 32
}
}
},
"range": [
2100,
2124
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 32
}
}
},
"range": [
2100,
2125
],
"loc": {
"start": {
"line": 47,
"column": 8
},
"end": {
"line": 47,
"column": 33
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2134,
2138
],
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "closingSelector",
"range": [
2139,
2154
],
"loc": {
"start": {
"line": 48,
"column": 13
},
"end": {
"line": 48,
"column": 28
}
}
},
"range": [
2134,
2154
],
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 28
}
}
},
"right": {
"type": "Identifier",
"name": "closingSelector",
"range": [
2157,
2172
],
"loc": {
"start": {
"line": 48,
"column": 31
},
"end": {
"line": 48,
"column": 46
}
}
},
"range": [
2134,
2172
],
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 46
}
}
},
"range": [
2134,
2173
],
"loc": {
"start": {
"line": 48,
"column": 8
},
"end": {
"line": 48,
"column": 47
}
}
}
],
"range": [
2090,
2179
],
"loc": {
"start": {
"line": 46,
"column": 61
},
"end": {
"line": 49,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
2033,
2179
],
"loc": {
"start": {
"line": 46,
"column": 4
},
"end": {
"line": 49,
"column": 5
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "BufferToggleOperator",
"range": [
2184,
2204
],
"loc": {
"start": {
"line": 50,
"column": 4
},
"end": {
"line": 50,
"column": 24
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
2205,
2214
],
"loc": {
"start": {
"line": 50,
"column": 25
},
"end": {
"line": 50,
"column": 34
}
}
},
"range": [
2184,
2214
],
"loc": {
"start": {
"line": 50,
"column": 4
},
"end": {
"line": 50,
"column": 34
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
2215,
2219
],
"loc": {
"start": {
"line": 50,
"column": 35
},
"end": {
"line": 50,
"column": 39
}
}
},
"range": [
2184,
2219
],
"loc": {
"start": {
"line": 50,
"column": 4
},
"end": {
"line": 50,
"column": 39
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2232,
2242
],
"loc": {
"start": {
"line": 50,
"column": 52
},
"end": {
"line": 50,
"column": 62
}
}
},
{
"type": "Identifier",
"name": "source",
"range": [
2244,
2250
],
"loc": {
"start": {
"line": 50,
"column": 64
},
"end": {
"line": 50,
"column": 70
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "source",
"range": [
2269,
2275
],
"loc": {
"start": {
"line": 51,
"column": 15
},
"end": {
"line": 51,
"column": 21
}
}
},
"property": {
"type": "Identifier",
"name": "_subscribe",
"range": [
2276,
2286
],
"loc": {
"start": {
"line": 51,
"column": 22
},
"end": {
"line": 51,
"column": 32
}
}
},
"range": [
2269,
2286
],
"loc": {
"start": {
"line": 51,
"column": 15
},
"end": {
"line": 51,
"column": 32
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "BufferToggleSubscriber",
"range": [
2291,
2313
],
"loc": {
"start": {
"line": 51,
"column": 37
},
"end": {
"line": 51,
"column": 59
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "subscriber",
"range": [
2314,
2324
],
"loc": {
"start": {
"line": 51,
"column": 60
},
"end": {
"line": 51,
"column": 70
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2326,
2330
],
"loc": {
"start": {
"line": 51,
"column": 72
},
"end": {
"line": 51,
"column": 76
}
}
},
"property": {
"type": "Identifier",
"name": "openings",
"range": [
2331,
2339
],
"loc": {
"start": {
"line": 51,
"column": 77
},
"end": {
"line": 51,
"column": 85
}
}
},
"range": [
2326,
2339
],
"loc": {
"start": {
"line": 51,
"column": 72
},
"end": {
"line": 51,
"column": 85
}
}
},
{
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2341,
2345
],
"loc": {
"start": {
"line": 51,
"column": 87
},
"end": {
"line": 51,
"column": 91
}
}
},
"property": {
"type": "Identifier",
"name": "closingSelector",
"range": [
2346,
2361
],
"loc": {
"start": {
"line": 51,
"column": 92
},
"end": {
"line": 51,
"column": 107
}
}
},
"range": [
2341,
2361
],
"loc": {
"start": {
"line": 51,
"column": 87
},
"end": {
"line": 51,
"column": 107
}
}
}
],
"range": [
2287,
2362
],
"loc": {
"start": {
"line": 51,
"column": 33
},
"end": {
"line": 51,
"column": 108
}
}
}
],
"range": [
2269,
2363
],
"loc": {
"start": {
"line": 51,
"column": 15
},
"end": {
"line": 51,
"column": 109
}
}
},
"range": [
2262,
2364
],
"loc": {
"start": {
"line": 51,
"column": 8
},
"end": {
"line": 51,
"column": 110
}
}
}
],
"range": [
2252,
2370
],
"loc": {
"start": {
"line": 50,
"column": 72
},
"end": {
"line": 52,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
2222,
2370
],
"loc": {
"start": {
"line": 50,
"column": 42
},
"end": {
"line": 52,
"column": 5
}
}