@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,477 lines (1,476 loc) • 468 kB
JSON
{
"type": "Program",
"body": [
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "Subject",
"range": [
9,
16
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 16
}
}
},
"imported": {
"type": "Identifier",
"name": "Subject",
"range": [
9,
16
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 16
}
}
},
"range": [
9,
16
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 16
}
}
}
],
"source": {
"type": "Literal",
"value": "../Subject",
"raw": "'../Subject'",
"range": [
24,
36
],
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 36
}
}
},
"range": [
0,
37
],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 37
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "async",
"range": [
47,
52
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
}
},
"imported": {
"type": "Identifier",
"name": "async",
"range": [
47,
52
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
}
},
"range": [
47,
52
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 14
}
}
}
],
"source": {
"type": "Literal",
"value": "../scheduler/async",
"raw": "'../scheduler/async'",
"range": [
60,
80
],
"loc": {
"start": {
"line": 2,
"column": 22
},
"end": {
"line": 2,
"column": 42
}
}
},
"range": [
38,
81
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 43
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "Subscriber",
"range": [
91,
101
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 19
}
}
},
"imported": {
"type": "Identifier",
"name": "Subscriber",
"range": [
91,
101
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 19
}
}
},
"range": [
91,
101
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 19
}
}
}
],
"source": {
"type": "Literal",
"value": "../Subscriber",
"raw": "'../Subscriber'",
"range": [
109,
124
],
"loc": {
"start": {
"line": 3,
"column": 27
},
"end": {
"line": 3,
"column": 42
}
}
},
"range": [
82,
125
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 43
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Branch out the source Observable values as a nested Observable periodically\n * in time.\n *\n * <span class=\"informal\">It's like {@link bufferTime}, but emits a nested\n * Observable instead of an array.</span>\n *\n * <img src=\"./img/windowTime.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable starts a new window periodically, as\n * determined by the `windowCreationInterval` argument. It emits each window\n * after a fixed timespan, specified by the `windowTimeSpan` argument. When the\n * source Observable completes or encounters an error, the output Observable\n * emits the current window and propagates the notification from the source\n * Observable. If `windowCreationInterval` is not provided, the output\n * Observable starts a new window when the previous window of duration\n * `windowTimeSpan` completes.\n *\n * @example <caption>In every window of 1 second each, emit at most 2 click events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.windowTime(1000)\n * .map(win => win.take(2)) // each window has at most 2 emissions\n * .mergeAll(); // flatten the Observable-of-Observables\n * result.subscribe(x => console.log(x));\n *\n * @example <caption>Every 5 seconds start a window 1 second long, and emit at most 2 click events per window</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.windowTime(1000, 5000)\n * .map(win => win.take(2)) // each window has at most 2 emissions\n * .mergeAll(); // flatten the Observable-of-Observables\n * result.subscribe(x => console.log(x));\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowToggle}\n * @see {@link windowWhen}\n * @see {@link bufferTime}\n *\n * @param {number} windowTimeSpan The amount of time to fill each window.\n * @param {number} [windowCreationInterval] The interval at which to start new\n * windows.\n * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the\n * intervals that determine window boundaries.\n * @return {Observable<Observable<T>>} An observable of windows, which in turn\n * are Observables.\n * @method windowTime\n * @owner Observable\n ",
"range": [
126,
2375
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 52,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "windowTime",
"range": [
2392,
2402
],
"loc": {
"start": {
"line": 53,
"column": 16
},
"end": {
"line": 53,
"column": 26
}
}
},
"params": [
{
"type": "Identifier",
"name": "windowTimeSpan",
"range": [
2403,
2417
],
"loc": {
"start": {
"line": 53,
"column": 27
},
"end": {
"line": 53,
"column": 41
}
}
},
{
"type": "Identifier",
"name": "windowCreationInterval",
"range": [
2419,
2441
],
"loc": {
"start": {
"line": 53,
"column": 43
},
"end": {
"line": 53,
"column": 65
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
2443,
2452
],
"loc": {
"start": {
"line": 53,
"column": 67
},
"end": {
"line": 53,
"column": 76
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "IfStatement",
"test": {
"type": "BinaryExpression",
"operator": "===",
"left": {
"type": "Identifier",
"name": "windowCreationInterval",
"range": [
2464,
2486
],
"loc": {
"start": {
"line": 54,
"column": 8
},
"end": {
"line": 54,
"column": 30
}
}
},
"right": {
"type": "UnaryExpression",
"operator": "void",
"argument": {
"type": "Literal",
"value": 0,
"raw": "0",
"range": [
2496,
2497
],
"loc": {
"start": {
"line": 54,
"column": 40
},
"end": {
"line": 54,
"column": 41
}
}
},
"prefix": true,
"range": [
2491,
2497
],
"loc": {
"start": {
"line": 54,
"column": 35
},
"end": {
"line": 54,
"column": 41
}
}
},
"range": [
2464,
2497
],
"loc": {
"start": {
"line": 54,
"column": 8
},
"end": {
"line": 54,
"column": 41
}
}
},
"consequent": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "Identifier",
"name": "windowCreationInterval",
"range": [
2501,
2523
],
"loc": {
"start": {
"line": 54,
"column": 45
},
"end": {
"line": 54,
"column": 67
}
}
},
"right": {
"type": "Literal",
"value": null,
"raw": "null",
"range": [
2526,
2530
],
"loc": {
"start": {
"line": 54,
"column": 70
},
"end": {
"line": 54,
"column": 74
}
}
},
"range": [
2501,
2530
],
"loc": {
"start": {
"line": 54,
"column": 45
},
"end": {
"line": 54,
"column": 74
}
}
},
"range": [
2501,
2531
],
"loc": {
"start": {
"line": 54,
"column": 45
},
"end": {
"line": 54,
"column": 75
}
}
}
],
"range": [
2499,
2533
],
"loc": {
"start": {
"line": 54,
"column": 43
},
"end": {
"line": 54,
"column": 77
}
}
},
"alternate": null,
"range": [
2460,
2533
],
"loc": {
"start": {
"line": 54,
"column": 4
},
"end": {
"line": 54,
"column": 77
}
}
},
{
"type": "IfStatement",
"test": {
"type": "BinaryExpression",
"operator": "===",
"left": {
"type": "Identifier",
"name": "scheduler",
"range": [
2542,
2551
],
"loc": {
"start": {
"line": 55,
"column": 8
},
"end": {
"line": 55,
"column": 17
}
}
},
"right": {
"type": "UnaryExpression",
"operator": "void",
"argument": {
"type": "Literal",
"value": 0,
"raw": "0",
"range": [
2561,
2562
],
"loc": {
"start": {
"line": 55,
"column": 27
},
"end": {
"line": 55,
"column": 28
}
}
},
"prefix": true,
"range": [
2556,
2562
],
"loc": {
"start": {
"line": 55,
"column": 22
},
"end": {
"line": 55,
"column": 28
}
}
},
"range": [
2542,
2562
],
"loc": {
"start": {
"line": 55,
"column": 8
},
"end": {
"line": 55,
"column": 28
}
}
},
"consequent": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "Identifier",
"name": "scheduler",
"range": [
2566,
2575
],
"loc": {
"start": {
"line": 55,
"column": 32
},
"end": {
"line": 55,
"column": 41
}
}
},
"right": {
"type": "Identifier",
"name": "async",
"range": [
2578,
2583
],
"loc": {
"start": {
"line": 55,
"column": 44
},
"end": {
"line": 55,
"column": 49
}
}
},
"range": [
2566,
2583
],
"loc": {
"start": {
"line": 55,
"column": 32
},
"end": {
"line": 55,
"column": 49
}
}
},
"range": [
2566,
2584
],
"loc": {
"start": {
"line": 55,
"column": 32
},
"end": {
"line": 55,
"column": 50
}
}
}
],
"range": [
2564,
2586
],
"loc": {
"start": {
"line": 55,
"column": 30
},
"end": {
"line": 55,
"column": 52
}
}
},
"alternate": null,
"range": [
2538,
2586
],
"loc": {
"start": {
"line": 55,
"column": 4
},
"end": {
"line": 55,
"column": 52
}
}
},
{
"type": "ReturnStatement",
"argument": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2598,
2602
],
"loc": {
"start": {
"line": 56,
"column": 11
},
"end": {
"line": 56,
"column": 15
}
}
},
"property": {
"type": "Identifier",
"name": "lift",
"range": [
2603,
2607
],
"loc": {
"start": {
"line": 56,
"column": 16
},
"end": {
"line": 56,
"column": 20
}
}
},
"range": [
2598,
2607
],
"loc": {
"start": {
"line": 56,
"column": 11
},
"end": {
"line": 56,
"column": 20
}
}
},
"arguments": [
{
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "WindowTimeOperator",
"range": [
2612,
2630
],
"loc": {
"start": {
"line": 56,
"column": 25
},
"end": {
"line": 56,
"column": 43
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "windowTimeSpan",
"range": [
2631,
2645
],
"loc": {
"start": {
"line": 56,
"column": 44
},
"end": {
"line": 56,
"column": 58
}
}
},
{
"type": "Identifier",
"name": "windowCreationInterval",
"range": [
2647,
2669
],
"loc": {
"start": {
"line": 56,
"column": 60
},
"end": {
"line": 56,
"column": 82
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
2671,
2680
],
"loc": {
"start": {
"line": 56,
"column": 84
},
"end": {
"line": 56,
"column": 93
}
}
}
],
"range": [
2608,
2681
],
"loc": {
"start": {
"line": 56,
"column": 21
},
"end": {
"line": 56,
"column": 94
}
}
}
],
"range": [
2598,
2682
],
"loc": {
"start": {
"line": 56,
"column": 11
},
"end": {
"line": 56,
"column": 95
}
}
},
"range": [
2591,
2683
],
"loc": {
"start": {
"line": 56,
"column": 4
},
"end": {
"line": 56,
"column": 96
}
}
}
],
"range": [
2454,
2685
],
"loc": {
"start": {
"line": 53,
"column": 78
},
"end": {
"line": 57,
"column": 1
}
}
},
"generator": false,
"expression": false,
"range": [
2383,
2685
],
"loc": {
"start": {
"line": 53,
"column": 7
},
"end": {
"line": 57,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Branch out the source Observable values as a nested Observable periodically\n * in time.\n *\n * <span class=\"informal\">It's like {@link bufferTime}, but emits a nested\n * Observable instead of an array.</span>\n *\n * <img src=\"./img/windowTime.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable starts a new window periodically, as\n * determined by the `windowCreationInterval` argument. It emits each window\n * after a fixed timespan, specified by the `windowTimeSpan` argument. When the\n * source Observable completes or encounters an error, the output Observable\n * emits the current window and propagates the notification from the source\n * Observable. If `windowCreationInterval` is not provided, the output\n * Observable starts a new window when the previous window of duration\n * `windowTimeSpan` completes.\n *\n * @example <caption>In every window of 1 second each, emit at most 2 click events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.windowTime(1000)\n * .map(win => win.take(2)) // each window has at most 2 emissions\n * .mergeAll(); // flatten the Observable-of-Observables\n * result.subscribe(x => console.log(x));\n *\n * @example <caption>Every 5 seconds start a window 1 second long, and emit at most 2 click events per window</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.windowTime(1000, 5000)\n * .map(win => win.take(2)) // each window has at most 2 emissions\n * .mergeAll(); // flatten the Observable-of-Observables\n * result.subscribe(x => console.log(x));\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowToggle}\n * @see {@link windowWhen}\n * @see {@link bufferTime}\n *\n * @param {number} windowTimeSpan The amount of time to fill each window.\n * @param {number} [windowCreationInterval] The interval at which to start new\n * windows.\n * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the\n * intervals that determine window boundaries.\n * @return {Observable<Observable<T>>} An observable of windows, which in turn\n * are Observables.\n * @method windowTime\n * @owner Observable\n ",
"range": [
126,
2375
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 52,
"column": 3
}
}
}
],
"trailingComments": []
},
"specifiers": [],
"source": null,
"range": [
2376,
2685
],
"loc": {
"start": {
"line": 53,
"column": 0
},
"end": {
"line": 57,
"column": 1
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Branch out the source Observable values as a nested Observable periodically\n * in time.\n *\n * <span class=\"informal\">It's like {@link bufferTime}, but emits a nested\n * Observable instead of an array.</span>\n *\n * <img src=\"./img/windowTime.png\" width=\"100%\">\n *\n * Returns an Observable that emits windows of items it collects from the source\n * Observable. The output Observable starts a new window periodically, as\n * determined by the `windowCreationInterval` argument. It emits each window\n * after a fixed timespan, specified by the `windowTimeSpan` argument. When the\n * source Observable completes or encounters an error, the output Observable\n * emits the current window and propagates the notification from the source\n * Observable. If `windowCreationInterval` is not provided, the output\n * Observable starts a new window when the previous window of duration\n * `windowTimeSpan` completes.\n *\n * @example <caption>In every window of 1 second each, emit at most 2 click events</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.windowTime(1000)\n * .map(win => win.take(2)) // each window has at most 2 emissions\n * .mergeAll(); // flatten the Observable-of-Observables\n * result.subscribe(x => console.log(x));\n *\n * @example <caption>Every 5 seconds start a window 1 second long, and emit at most 2 click events per window</caption>\n * var clicks = Rx.Observable.fromEvent(document, 'click');\n * var result = clicks.windowTime(1000, 5000)\n * .map(win => win.take(2)) // each window has at most 2 emissions\n * .mergeAll(); // flatten the Observable-of-Observables\n * result.subscribe(x => console.log(x));\n *\n * @see {@link window}\n * @see {@link windowCount}\n * @see {@link windowToggle}\n * @see {@link windowWhen}\n * @see {@link bufferTime}\n *\n * @param {number} windowTimeSpan The amount of time to fill each window.\n * @param {number} [windowCreationInterval] The interval at which to start new\n * windows.\n * @param {Scheduler} [scheduler=async] The scheduler on which to schedule the\n * intervals that determine window boundaries.\n * @return {Observable<Observable<T>>} An observable of windows, which in turn\n * are Observables.\n * @method windowTime\n * @owner Observable\n ",
"range": [
126,
2375
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 52,
"column": 3
}
}
}
]
},
{
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "WindowTimeOperator",
"range": [
2690,
2708
],
"loc": {
"start": {
"line": 58,
"column": 4
},
"end": {
"line": 58,
"column": 22
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "WindowTimeOperator",
"range": [
2739,
2757
],
"loc": {
"start": {
"line": 59,
"column": 13
},
"end": {
"line": 59,
"column": 31
}
}
},
"params": [
{
"type": "Identifier",
"name": "windowTimeSpan",
"range": [
2758,
2772
],
"loc": {
"start": {
"line": 59,
"column": 32
},
"end": {
"line": 59,
"column": 46
}
}
},
{
"type": "Identifier",
"name": "windowCreationInterval",
"range": [
2774,
2796
],
"loc": {
"start": {
"line": 59,
"column": 48
},
"end": {
"line": 59,
"column": 70
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
2798,
2807
],
"loc": {
"start": {
"line": 59,
"column": 72
},
"end": {
"line": 59,
"column": 81
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2819,
2823
],
"loc": {
"start": {
"line": 60,
"column": 8
},
"end": {
"line": 60,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "windowTimeSpan",
"range": [
2824,
2838
],
"loc": {
"start": {
"line": 60,
"column": 13
},
"end": {
"line": 60,
"column": 27
}
}
},
"range": [
2819,
2838
],
"loc": {
"start": {
"line": 60,
"column": 8
},
"end": {
"line": 60,
"column": 27
}
}
},
"right": {
"type": "Identifier",
"name": "windowTimeSpan",
"range": [
2841,
2855
],
"loc": {
"start": {
"line": 60,
"column": 30
},
"end": {
"line": 60,
"column": 44
}
}
},
"range": [
2819,
2855
],
"loc": {
"start": {
"line": 60,
"column": 8
},
"end": {
"line": 60,
"column": 44
}
}
},
"range": [
2819,
2856
],
"loc": {
"start": {
"line": 60,
"column": 8
},
"end": {
"line": 60,
"column": 45
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2865,
2869
],
"loc": {
"start": {
"line": 61,
"column": 8
},
"end": {
"line": 61,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "windowCreationInterval",
"range": [
2870,
2892
],
"loc": {
"start": {
"line": 61,
"column": 13
},
"end": {
"line": 61,
"column": 35
}
}
},
"range": [
2865,
2892
],
"loc": {
"start": {
"line": 61,
"column": 8
},
"end": {
"line": 61,
"column": 35
}
}
},
"right": {
"type": "Identifier",
"name": "windowCreationInterval",
"range": [
2895,
2917
],
"loc": {
"start": {
"line": 61,
"column": 38
},
"end": {
"line": 61,
"column": 60
}
}
},
"range": [
2865,
2917
],
"loc": {
"start": {
"line": 61,
"column": 8
},
"end": {
"line": 61,
"column": 60
}
}
},
"range": [
2865,
2918
],
"loc": {
"start": {
"line": 61,
"column": 8
},
"end": {
"line": 61,
"column": 61
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
2927,
2931
],
"loc": {
"start": {
"line": 62,
"column": 8
},
"end": {
"line": 62,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "scheduler",
"range": [
2932,
2941
],
"loc": {
"start": {
"line": 62,
"column": 13
},
"end": {
"line": 62,
"column": 22
}
}
},
"range": [
2927,
2941
],
"loc": {
"start": {
"line": 62,
"column": 8
},
"end": {
"line": 62,
"column": 22
}
}
},
"right": {
"type": "Identifier",
"name": "scheduler",
"range": [
2944,
2953
],
"loc": {
"start": {
"line": 62,
"column": 25
},
"end": {
"line": 62,
"column": 34
}
}
},
"range": [
2927,
2953
],
"loc": {
"start": {
"line": 62,
"column": 8
},
"end": {
"line": 62,
"column": 34
}
}
},
"range": [
2927,
2954
],
"loc": {
"start": {
"line": 62,
"column": 8
},
"end": {
"line": 62,
"column": 35
}
}
}
],
"range": [
2809,
2960
],
"loc": {
"start": {
"line": 59,
"column": 83
},
"end": {
"line": 63,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
2730,
2960
],
"loc": {
"start": {
"line": 59,
"column": 4
},
"end": {
"line": 63,
"column": 5
}
}
},
{