@reactivex/rxjs
Version:
Reactive Extensions for modern JavaScript
1,405 lines (1,404 loc) • 671 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": "tryCatch",
"range": [
53,
61
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 17
}
}
},
"imported": {
"type": "Identifier",
"name": "tryCatch",
"range": [
53,
61
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 17
}
}
},
"range": [
53,
61
],
"loc": {
"start": {
"line": 2,
"column": 9
},
"end": {
"line": 2,
"column": 17
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/tryCatch",
"raw": "'../util/tryCatch'",
"range": [
69,
87
],
"loc": {
"start": {
"line": 2,
"column": 25
},
"end": {
"line": 2,
"column": 43
}
}
},
"range": [
44,
88
],
"loc": {
"start": {
"line": 2,
"column": 0
},
"end": {
"line": 2,
"column": 44
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "errorObject",
"range": [
98,
109
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 20
}
}
},
"imported": {
"type": "Identifier",
"name": "errorObject",
"range": [
98,
109
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 20
}
}
},
"range": [
98,
109
],
"loc": {
"start": {
"line": 3,
"column": 9
},
"end": {
"line": 3,
"column": 20
}
}
}
],
"source": {
"type": "Literal",
"value": "../util/errorObject",
"raw": "'../util/errorObject'",
"range": [
117,
138
],
"loc": {
"start": {
"line": 3,
"column": 28
},
"end": {
"line": 3,
"column": 49
}
}
},
"range": [
89,
139
],
"loc": {
"start": {
"line": 3,
"column": 0
},
"end": {
"line": 3,
"column": 50
}
}
},
{
"type": "ImportDeclaration",
"specifiers": [
{
"type": "ImportSpecifier",
"local": {
"type": "Identifier",
"name": "AsyncSubject",
"range": [
149,
161
],
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 21
}
}
},
"imported": {
"type": "Identifier",
"name": "AsyncSubject",
"range": [
149,
161
],
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 21
}
}
},
"range": [
149,
161
],
"loc": {
"start": {
"line": 4,
"column": 9
},
"end": {
"line": 4,
"column": 21
}
}
}
],
"source": {
"type": "Literal",
"value": "../AsyncSubject",
"raw": "'../AsyncSubject'",
"range": [
169,
186
],
"loc": {
"start": {
"line": 4,
"column": 29
},
"end": {
"line": 4,
"column": 46
}
}
},
"range": [
140,
187
],
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 4,
"column": 47
}
},
"trailingComments": [
{
"type": "Block",
"value": "*\n * We need this JSDoc comment for affecting ESDoc.\n * @extends {Ignored}\n * @hide true\n ",
"range": [
188,
282
],
"loc": {
"start": {
"line": 5,
"column": 0
},
"end": {
"line": 9,
"column": 3
}
}
}
]
},
{
"type": "ExportNamedDeclaration",
"declaration": {
"type": "VariableDeclaration",
"declarations": [
{
"type": "VariableDeclarator",
"id": {
"type": "Identifier",
"name": "BoundCallbackObservable",
"range": [
294,
317
],
"loc": {
"start": {
"line": 10,
"column": 11
},
"end": {
"line": 10,
"column": 34
}
}
},
"init": {
"type": "CallExpression",
"callee": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "_super",
"range": [
331,
337
],
"loc": {
"start": {
"line": 10,
"column": 48
},
"end": {
"line": 10,
"column": 54
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "Identifier",
"name": "__extends",
"range": [
345,
354
],
"loc": {
"start": {
"line": 11,
"column": 4
},
"end": {
"line": 11,
"column": 13
}
}
},
"arguments": [
{
"type": "Identifier",
"name": "BoundCallbackObservable",
"range": [
355,
378
],
"loc": {
"start": {
"line": 11,
"column": 14
},
"end": {
"line": 11,
"column": 37
}
}
},
{
"type": "Identifier",
"name": "_super",
"range": [
380,
386
],
"loc": {
"start": {
"line": 11,
"column": 39
},
"end": {
"line": 11,
"column": 45
}
}
}
],
"range": [
345,
387
],
"loc": {
"start": {
"line": 11,
"column": 4
},
"end": {
"line": 11,
"column": 46
}
}
},
"range": [
345,
388
],
"loc": {
"start": {
"line": 11,
"column": 4
},
"end": {
"line": 11,
"column": 47
}
}
},
{
"type": "FunctionDeclaration",
"id": {
"type": "Identifier",
"name": "BoundCallbackObservable",
"range": [
402,
425
],
"loc": {
"start": {
"line": 12,
"column": 13
},
"end": {
"line": 12,
"column": 36
}
}
},
"params": [
{
"type": "Identifier",
"name": "callbackFunc",
"range": [
426,
438
],
"loc": {
"start": {
"line": 12,
"column": 37
},
"end": {
"line": 12,
"column": 49
}
}
},
{
"type": "Identifier",
"name": "selector",
"range": [
440,
448
],
"loc": {
"start": {
"line": 12,
"column": 51
},
"end": {
"line": 12,
"column": 59
}
}
},
{
"type": "Identifier",
"name": "args",
"range": [
450,
454
],
"loc": {
"start": {
"line": 12,
"column": 61
},
"end": {
"line": 12,
"column": 65
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
456,
465
],
"loc": {
"start": {
"line": 12,
"column": 67
},
"end": {
"line": 12,
"column": 76
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "ExpressionStatement",
"expression": {
"type": "CallExpression",
"callee": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "_super",
"range": [
477,
483
],
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 14
}
}
},
"property": {
"type": "Identifier",
"name": "call",
"range": [
484,
488
],
"loc": {
"start": {
"line": 13,
"column": 15
},
"end": {
"line": 13,
"column": 19
}
}
},
"range": [
477,
488
],
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 19
}
}
},
"arguments": [
{
"type": "ThisExpression",
"range": [
489,
493
],
"loc": {
"start": {
"line": 13,
"column": 20
},
"end": {
"line": 13,
"column": 24
}
}
}
],
"range": [
477,
494
],
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 25
}
}
},
"range": [
477,
495
],
"loc": {
"start": {
"line": 13,
"column": 8
},
"end": {
"line": 13,
"column": 26
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
504,
508
],
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "callbackFunc",
"range": [
509,
521
],
"loc": {
"start": {
"line": 14,
"column": 13
},
"end": {
"line": 14,
"column": 25
}
}
},
"range": [
504,
521
],
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 25
}
}
},
"right": {
"type": "Identifier",
"name": "callbackFunc",
"range": [
524,
536
],
"loc": {
"start": {
"line": 14,
"column": 28
},
"end": {
"line": 14,
"column": 40
}
}
},
"range": [
504,
536
],
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 40
}
}
},
"range": [
504,
537
],
"loc": {
"start": {
"line": 14,
"column": 8
},
"end": {
"line": 14,
"column": 41
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
546,
550
],
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "selector",
"range": [
551,
559
],
"loc": {
"start": {
"line": 15,
"column": 13
},
"end": {
"line": 15,
"column": 21
}
}
},
"range": [
546,
559
],
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 21
}
}
},
"right": {
"type": "Identifier",
"name": "selector",
"range": [
562,
570
],
"loc": {
"start": {
"line": 15,
"column": 24
},
"end": {
"line": 15,
"column": 32
}
}
},
"range": [
546,
570
],
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 32
}
}
},
"range": [
546,
571
],
"loc": {
"start": {
"line": 15,
"column": 8
},
"end": {
"line": 15,
"column": 33
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
580,
584
],
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "args",
"range": [
585,
589
],
"loc": {
"start": {
"line": 16,
"column": 13
},
"end": {
"line": 16,
"column": 17
}
}
},
"range": [
580,
589
],
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 17
}
}
},
"right": {
"type": "Identifier",
"name": "args",
"range": [
592,
596
],
"loc": {
"start": {
"line": 16,
"column": 20
},
"end": {
"line": 16,
"column": 24
}
}
},
"range": [
580,
596
],
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 24
}
}
},
"range": [
580,
597
],
"loc": {
"start": {
"line": 16,
"column": 8
},
"end": {
"line": 16,
"column": 25
}
}
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "ThisExpression",
"range": [
606,
610
],
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 12
}
}
},
"property": {
"type": "Identifier",
"name": "scheduler",
"range": [
611,
620
],
"loc": {
"start": {
"line": 17,
"column": 13
},
"end": {
"line": 17,
"column": 22
}
}
},
"range": [
606,
620
],
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 22
}
}
},
"right": {
"type": "Identifier",
"name": "scheduler",
"range": [
623,
632
],
"loc": {
"start": {
"line": 17,
"column": 25
},
"end": {
"line": 17,
"column": 34
}
}
},
"range": [
606,
632
],
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 34
}
}
},
"range": [
606,
633
],
"loc": {
"start": {
"line": 17,
"column": 8
},
"end": {
"line": 17,
"column": 35
}
}
}
],
"range": [
467,
639
],
"loc": {
"start": {
"line": 12,
"column": 78
},
"end": {
"line": 18,
"column": 5
}
}
},
"generator": false,
"expression": false,
"range": [
393,
639
],
"loc": {
"start": {
"line": 12,
"column": 4
},
"end": {
"line": 18,
"column": 5
}
},
"trailingComments": [
{
"type": "Block",
"value": " tslint:enable:max-line-length ",
"range": [
644,
679
],
"loc": {
"start": {
"line": 19,
"column": 4
},
"end": {
"line": 19,
"column": 39
}
}
},
{
"type": "Block",
"value": "*\n * Converts a callback API to a function that returns an Observable.\n *\n * <span class=\"informal\">Give it a function `f` of type `f(x, callback)` and\n * it will return a function `g` that when called as `g(x)` will output an\n * Observable.</span>\n *\n * `bindCallback` is not an operator because its input and output are not\n * Observables. The input is a function `func` with some parameters, but the\n * last parameter must be a callback function that `func` calls when it is\n * done. The output of `bindCallback` is a function that takes the same\n * parameters as `func`, except the last one (the callback). When the output\n * function is called with arguments, it will return an Observable where the\n * results will be delivered to.\n *\n * @example <caption>Convert jQuery's getJSON to an Observable API</caption>\n * // Suppose we have jQuery.getJSON('/my/url', callback)\n * var getJSONAsObservable = Rx.Observable.bindCallback(jQuery.getJSON);\n * var result = getJSONAsObservable('/my/url');\n * result.subscribe(x => console.log(x), e => console.error(e));\n *\n * @see {@link bindNodeCallback}\n * @see {@link from}\n * @see {@link fromPromise}\n *\n * @param {function} func Function with a callback as the last parameter.\n * @param {function} [selector] A function which takes the arguments from the\n * callback and maps those a value to emit on the output Observable.\n * @param {Scheduler} [scheduler] The scheduler on which to schedule the\n * callbacks.\n * @return {function(...params: *): Observable} A function which returns the\n * Observable that delivers the same values the callback would deliver.\n * @static true\n * @name bindCallback\n * @owner Observable\n ",
"range": [
684,
2494
],
"loc": {
"start": {
"line": 20,
"column": 4
},
"end": {
"line": 55,
"column": 7
}
}
}
]
},
{
"type": "ExpressionStatement",
"expression": {
"type": "AssignmentExpression",
"operator": "=",
"left": {
"type": "MemberExpression",
"computed": false,
"object": {
"type": "Identifier",
"name": "BoundCallbackObservable",
"range": [
2499,
2522
],
"loc": {
"start": {
"line": 56,
"column": 4
},
"end": {
"line": 56,
"column": 27
}
}
},
"property": {
"type": "Identifier",
"name": "create",
"range": [
2523,
2529
],
"loc": {
"start": {
"line": 56,
"column": 28
},
"end": {
"line": 56,
"column": 34
}
}
},
"range": [
2499,
2529
],
"loc": {
"start": {
"line": 56,
"column": 4
},
"end": {
"line": 56,
"column": 34
}
}
},
"right": {
"type": "FunctionExpression",
"id": null,
"params": [
{
"type": "Identifier",
"name": "func",
"range": [
2542,
2546
],
"loc": {
"start": {
"line": 56,
"column": 47
},
"end": {
"line": 56,
"column": 51
}
}
},
{
"type": "Identifier",
"name": "selector",
"range": [
2548,
2556
],
"loc": {
"start": {
"line": 56,
"column": 53
},
"end": {
"line": 56,
"column": 61
}
}
},
{
"type": "Identifier",
"name": "scheduler",
"range": [
2558,
2567
],
"loc": {
"start": {
"line": 56,
"column": 63
},
"end": {
"line": 56,
"column": 72
}
}
}
],
"body": {
"type": "BlockStatement",
"body": [
{
"type": "IfStatement",
"test": {
"type": "BinaryExpression",
"operator": "===",
"left": {
"type": "Identifier",
"name": "selector",
"range": [
2583,
2591
],
"loc": {
"start": {
"line": 57,
"column": 12
},
"end": {
"line": 57,
"column": 20
}
}
},
"right": {
"type": "UnaryExpression",
"operator": "void",
"argument": {
"type": "Literal",
"value": 0,
"raw": "0",
"range": [
2601,
2602
],
"loc": {
"start": {
"line": 57,
"column": 30
},
"end": {
"line": 57,
"column": 31
}
}
},
"prefix": true,
"range": [
2596,
2602
],
"loc": {
"start": {
"line": 57,
"column": 25