@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,268 lines (1,267 loc) • 208 kB
JSON
{
"type": "Program",
"body": [
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "Observable",
"range": [
9,
19
],
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 19
}
}
},
"imported": {
"type": "Identifier",
"name": "Observable",
"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": "../Observable",
"raw": "'../Observable'",
"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": "Subscription",
"range": [
53,
65
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 21
}
}
},
"imported": {
"type": "Identifier",
"name": "Subscription",
"range": [
53,
65
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 21
}
}
},
"range": [
53,
65
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 21
}
}
}
],
"source": {
"type": "Literal",
"value": "../Subscription",
"raw": "'../Subscription'",
"range": [
73,
90
],
"loc": {
"start": {
"line": 2,
"column": 29
},
"end": {
"line": 2,
"column": 46
}
}
},
"range": [
44,
91
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 47
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n ",
"range": [
92,
186
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 7,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "FromEventPatternObservable",
"range": [
198,
224
],
"loc": {
"start": {
"line": 8,
"column": 11
},
"end": {
"line": 8,
"column": 37
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "_super",
"range": [
238,
244
],
"loc": {
"start": {
"line": 8,
"column": 51
},
"end": {
"line": 8,
"column": 57
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "__extends",
"range": [
252,
261
],
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 13
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "FromEventPatternObservable",
"range": [
262,
288
],
"loc": {
"start": {
"line": 9,
"column": 14
},
"end": {
"line": 9,
"column": 40
}
}
},
{
"type": "Identifier",
"name": "_super",
"range": [
290,
296
],
"loc": {
"start": {
"line": 9,
"column": 42
},
"end": {
"line": 9,
"column": 48
}
}
}
],
"range": [
252,
297
],
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 49
}
}
},
"range": [
252,
298
],
"loc": {
"start": {
"line": 9,
"column": 4
},
"end": {
"line": 9,
"column": 50
}
}
},
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "FromEventPatternObservable",
"range": [
312,
338
],
"loc": {
"start": {
"line": 10,
"column": 13
},
"end": {
"line": 10,
"column": 39
}
}
},
"params": [
{
"type": "Identifier",
"name": "addHandler",
"range": [
339,
349
],
"loc": {
"start": {
"line": 10,
"column": 40
},
"end": {
"line": 10,
"column": 50
}
}
},
{
"type": "Identifier",
"name": "removeHandler",
"range": [
351,
364
],
"loc": {
"start": {
"line": 10,
"column": 52
},
"end": {
"line": 10,
"column": 65
}
}
},
{
"type": "Identifier",
"name": "selector",
"range": [
366,
374
],
"loc": {
"start": {
"line": 10,
"column": 67
},
"end": {
"line": 10,
"column": 75
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "_super",
"range": [
386,
392
],
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 14
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
393,
397
],
"loc": {
"start": {
"line": 11,
"column": 15
},
"end": {
"line": 11,
"column": 19
}
}
},
"range": [
386,
397
],
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 19
}
}
},
"arguments": [
{
"type": "ThisExpression",
"range": [
398,
402
],
"loc": {
"start": {
"line": 11,
"column": 20
},
"end": {
"line": 11,
"column": 24
}
}
}
],
"range": [
386,
403
],
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 25
}
}
},
"range": [
386,
404
],
"loc": {
"start": {
"line": 11,
"column": 8
},
"end": {
"line": 11,
"column": 26
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
413,
417
],
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "addHandler",
"range": [
418,
428
],
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 23
}
}
},
"range": [
413,
428
],
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 23
}
}
},
"right": {
"type": "Identifier",
"name": "addHandler",
"range": [
431,
441
],
"loc": {
"start": {
"line": 12,
"column": 26
},
"end": {
"line": 12,
"column": 36
}
}
},
"range": [
413,
441
],
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 36
}
}
},
"range": [
413,
442
],
"loc": {
"start": {
"line": 12,
"column": 8
},
"end": {
"line": 12,
"column": 37
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
451,
455
],
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "removeHandler",
"range": [
456,
469
],
"loc": {
"start": {
"line": 13,
"column": 13
},
"end": {
"line": 13,
"column": 26
}
}
},
"range": [
451,
469
],
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 26
}
}
},
"right": {
"type": "Identifier",
"name": "removeHandler",
"range": [
472,
485
],
"loc": {
"start": {
"line": 13,
"column": 29
},
"end": {
"line": 13,
"column": 42
}
}
},
"range": [
451,
485
],
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 42
}
}
},
"range": [
451,
486
],
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 43
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
495,
499
],
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "selector",
"range": [
500,
508
],
"loc": {
"start": {
"line": 14,
"column": 13
},
"end": {
"line": 14,
"column": 21
}
}
},
"range": [
495,
508
],
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 21
}
}
},
"right": {
"type": "Identifier",
"name": "selector",
"range": [
511,
519
],
"loc": {
"start": {
"line": 14,
"column": 24
},
"end": {
"line": 14,
"column": 32
}
}
},
"range": [
495,
519
],
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 32
}
}
},
"range": [
495,
520
],
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 33
}
}
}
],
"range": [
376,
526
],
"loc": {
"start": {
"line": 10,
"column": 77
},
"end": {
"line": 15,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
303,
526
],
"loc": {
"start": {
"line": 10,
"column": 4
},
"end": {
"line": 15,
"column": 5
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * Creates an Observable from an API based on addHandler/removeHandler\n * functions.\n *\n * <span class=\"informal\">Converts any addHandler/removeHandler API to an\n * Observable.</span>\n *\n * <img src=\"./img/fromEventPattern.png\" width=\"100%\">\n *\n * Creates an Observable by using the `addHandler` and `removeHandler`\n * functions to add and remove the handlers, with an optional selector\n * function to project the event arguments to a result. The `addHandler` is\n * called when the output Observable is subscribed, and `removeHandler` is\n * called when the Subscription is unsubscribed.\n *\n * @example <caption>Emits clicks happening on the DOM document</caption>\n * function addClickHandler(handler) {\n * document.addEventListener('click', handler);\n * }\n *\n * function removeClickHandler(handler) {\n * document.removeEventListener('click', handler);\n * }\n *\n * var clicks = Rx.Observable.fromEventPattern(\n * addClickHandler,\n * removeClickHandler\n * );\n * clicks.subscribe(x => console.log(x));\n *\n * @see {@link from}\n * @see {@link fromEvent}\n *\n * @param {function(handler: Function): any} addHandler A function that takes\n * a `handler` function as argument and attaches it somehow to the actual\n * source of events.\n * @param {function(handler: Function): void} removeHandler A function that\n * takes a `handler` function as argument and removes it in case it was\n * previously attached using `addHandler`.\n * @param {function(...args: any): T} [selector] An optional function to\n * post-process results. It takes the arguments from the event handler and\n * should return a single value.\n * @return {Observable<T>}\n * @static true\n * @name fromEventPattern\n * @owner Observable\n ",
"range": [
531,
2416
],
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 62,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "FromEventPatternObservable",
"range": [
2421,
2447
],
"loc": {
"start": {
"line": 63,
"column": 4
},
"end": {
"line": 63,
"column": 30
}
}
},
"property": {
"type": "Identifier",
"name": "create",
"range": [
2448,
2454
],
"loc": {
"start": {
"line": 63,
"column": 31
},
"end": {
"line": 63,
"column": 37
}
}
},
"range": [
2421,
2454
],
"loc": {
"start": {
"line": 63,
"column": 4
},
"end": {
"line": 63,
"column": 37
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "addHandler",
"range": [
2467,
2477
],
"loc": {
"start": {
"line": 63,
"column": 50
},
"end": {
"line": 63,
"column": 60
}
}
},
{
"type": "Identifier",
"name": "removeHandler",
"range": [
2479,
2492
],
"loc": {
"start": {
"line": 63,
"column": 62
},
"end": {
"line": 63,
"column": 75
}
}
},
{
"type": "Identifier",
"name": "selector",
"range": [
2494,
2502
],
"loc": {
"start": {
"line": 63,
"column": 77
},
"end": {
"line": 63,
"column": 85
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ReturnStatement",
"argument": {
"type": "NewExpression",
"callee": {
"type": "Identifier",
"name": "FromEventPatternObservable",
"range": [
2525,
2551
],
"loc": {
"start": {
"line": 64,
"column": 19
},
"end": {
"line": 64,
"column": 45
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "addHandler",
"range": [
2552,
2562
],
"loc": {
"start": {
"line": 64,
"column": 46
},
"end": {
"line": 64,
"column": 56
}
}
},
{
"type": "Identifier",
"name": "removeHandler",
"range": [
2564,
2577
],
"loc": {
"start": {
"line": 64,
"column": 58
},
"end": {
"line": 64,
"column": 71
}
}
},
{
"type": "Identifier",
"name": "selector",
"range": [
2579,
2587
],
"loc": {
"start": {
"line": 64,
"column": 73
},
"end": {
"line": 64,
"column": 81
}
}
}
],
"range": [
2521,
2588
],
"loc": {
"start": {
"line": 64,
"column": 15
},
"end": {
"line": 64,
"column": 82
}
}
},
"range": [
2514,
2589
],
"loc": {
"start": {
"line": 64,
"column": 8
},
"end": {
"line": 64,
"column": 83
}
}
}
],
"range": [
2504,
2595
],
"loc": {
"start": {
"line": 63,
"column": 87
},
"end": {
"line": 65,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
2457,
2595
],
"loc": {
"start": {
"line": 63,
"column": 40
},
"end": {
"line": 65,
"column": 5
}
}
},
"range": [
2421,
2595
],
"loc": {
"start": {
"line": 63,
"column": 4
},
"end": {
"line": 65,
"column": 5
}
}
},
"range": [
2421,
2596
],
"loc": {
"start": {
"line": 63,
"column": 4
},
"end": {
"line": 65,
"column": 6
}
},
"leadingComments": [
{
"type": "Block",
"value": "*\n * Creates an Observable from an API based on addHandler/removeHandler\n * functions.\n *\n * <span class=\"informal\">Converts any addHandler/removeHandler API to an\n * Observable.</span>\n *\n * <img src=\"./img/fromEventPattern.png\" width=\"100%\">\n *\n * Creates an Observable by using the `addHandler` and `removeHandler`\n * functions to add and remove the handlers, with an optional selector\n * function to project the event arguments to a result. The `addHandler` is\n * called when the output Observable is subscribed, and `removeHandler` is\n * called when the Subscription is unsubscribed.\n *\n * @example <caption>Emits clicks happening on the DOM document</caption>\n * function addClickHandler(handler) {\n * document.addEventListener('click', handler);\n * }\n *\n * function removeClickHandler(handler) {\n * document.removeEventListener('click', handler);\n * }\n *\n * var clicks = Rx.Observable.fromEventPattern(\n * addClickHandler,\n * removeClickHandler\n * );\n * clicks.subscribe(x => console.log(x));\n *\n * @see {@link from}\n * @see {@link fromEvent}\n *\n * @param {function(handler: Function): any} addHandler A function that takes\n * a `handler` function as argument and attaches it somehow to the actual\n * source of events.\n * @param {function(handler: Function): void} removeHandler A function that\n * takes a `handler` function as argument and removes it in case it was\n * previously attached using `addHandler`.\n * @param {function(...args: any): T} [selector] An optional function to\n * post-process results. It takes the arguments from the event handler and\n * should return a single value.\n * @return {Observable<T>}\n * @static true\n * @name fromEventPattern\n * @owner Observable\n ",
"range": [
531,
2416
],
"loc": {
"start": {
"line": 16,
"column": 4
},
"end": {
"line": 62,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "FromEventPatternObservable",
"range": [
2601,
2627
],
"loc": {
"start": {
"line": 66,
"column": 4
},
"end": {
"line": 66,
"column": 30
}
}
},
"property": {
"type": "Identifier",
"name": "prototype",
"range": [
2628,
2637
],
"loc": {
"start": {
"line": 66,
"column": 31
},
"end": {
"line": 66,
"column": 40
}
}
},
"range": [
2601,
2637