browser_jsonp.js
2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Injectable } from '@angular/core';
var /** @type {?} */ _nextRequestId = 0;
export var /** @type {?} */ JSONP_HOME = '__ng_jsonp__';
var /** @type {?} */ _jsonpConnections = null;
/**
* @return {?}
*/
function _getJsonpConnections() {
var /** @type {?} */ w = typeof window == 'object' ? window : {};
if (_jsonpConnections === null) {
_jsonpConnections = w[JSONP_HOME] = {};
}
return _jsonpConnections;
}
export var BrowserJsonp = (function () {
function BrowserJsonp() {
}
/**
* @param {?} url
* @return {?}
*/
BrowserJsonp.prototype.build = function (url) {
var /** @type {?} */ node = document.createElement('script');
node.src = url;
return node;
};
/**
* @return {?}
*/
BrowserJsonp.prototype.nextRequestID = function () { return "__req" + _nextRequestId++; };
/**
* @param {?} id
* @return {?}
*/
BrowserJsonp.prototype.requestCallback = function (id) { return JSONP_HOME + "." + id + ".finished"; };
/**
* @param {?} id
* @param {?} connection
* @return {?}
*/
BrowserJsonp.prototype.exposeConnection = function (id, connection) {
var /** @type {?} */ connections = _getJsonpConnections();
connections[id] = connection;
};
/**
* @param {?} id
* @return {?}
*/
BrowserJsonp.prototype.removeConnection = function (id) {
var /** @type {?} */ connections = _getJsonpConnections();
connections[id] = null;
};
/**
* @param {?} node
* @return {?}
*/
BrowserJsonp.prototype.send = function (node) { document.body.appendChild(/** @type {?} */ ((node))); };
/**
* @param {?} node
* @return {?}
*/
BrowserJsonp.prototype.cleanup = function (node) {
if (node.parentNode) {
node.parentNode.removeChild(/** @type {?} */ ((node)));
}
};
BrowserJsonp.decorators = [
{ type: Injectable },
];
/** @nocollapse */
BrowserJsonp.ctorParameters = function () { return []; };
return BrowserJsonp;
}());
function BrowserJsonp_tsickle_Closure_declarations() {
/** @type {?} */
BrowserJsonp.decorators;
/**
* @nocollapse
* @type {?}
*/
BrowserJsonp.ctorParameters;
}
//# sourceMappingURL=browser_jsonp.js.map