@datadog/browser-core
Advanced tools
Comparing version 1.15.0 to 1.15.1
@@ -45,30 +45,32 @@ "use strict"; | ||
}); | ||
XMLHttpRequest.prototype.send = function (body) { | ||
XMLHttpRequest.prototype.send = internalMonitoring_1.monitor(function (body) { | ||
var _this = this; | ||
this._datadog_xhr.startTime = performance.now(); | ||
var originalOnreadystatechange = this.onreadystatechange; | ||
this.onreadystatechange = function () { | ||
if (this.readyState === XMLHttpRequest.DONE) { | ||
internalMonitoring_1.monitor(reportXhr)(); | ||
} | ||
if (originalOnreadystatechange) { | ||
originalOnreadystatechange.apply(this, arguments); | ||
} | ||
}; | ||
var hasBeenReported = false; | ||
var reportXhr = function () { | ||
if (hasBeenReported) { | ||
return; | ||
} | ||
hasBeenReported = true; | ||
_this._datadog_xhr.duration = performance.now() - _this._datadog_xhr.startTime; | ||
_this._datadog_xhr.response = _this.response; | ||
_this._datadog_xhr.status = _this.status; | ||
onRequestCompleteCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr); }); | ||
}; | ||
this.addEventListener('loadend', internalMonitoring_1.monitor(reportXhr)); | ||
beforeSendCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr); }); | ||
if (this._datadog_xhr) { | ||
this._datadog_xhr.startTime = performance.now(); | ||
var originalOnreadystatechange_1 = this.onreadystatechange; | ||
this.onreadystatechange = function () { | ||
if (this.readyState === XMLHttpRequest.DONE) { | ||
internalMonitoring_1.monitor(reportXhr_1)(); | ||
} | ||
if (originalOnreadystatechange_1) { | ||
originalOnreadystatechange_1.apply(this, arguments); | ||
} | ||
}; | ||
var hasBeenReported_1 = false; | ||
var reportXhr_1 = function () { | ||
if (hasBeenReported_1) { | ||
return; | ||
} | ||
hasBeenReported_1 = true; | ||
_this._datadog_xhr.duration = performance.now() - _this._datadog_xhr.startTime; | ||
_this._datadog_xhr.response = _this.response; | ||
_this._datadog_xhr.status = _this.status; | ||
onRequestCompleteCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr); }); | ||
}; | ||
this.addEventListener('loadend', internalMonitoring_1.monitor(reportXhr_1)); | ||
beforeSendCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr); }); | ||
} | ||
return originalXhrSend.apply(this, arguments); | ||
}; | ||
}); | ||
} | ||
//# sourceMappingURL=xhrProxy.js.map |
@@ -41,30 +41,32 @@ import { monitor } from './internalMonitoring'; | ||
}); | ||
XMLHttpRequest.prototype.send = function (body) { | ||
XMLHttpRequest.prototype.send = monitor(function (body) { | ||
var _this = this; | ||
this._datadog_xhr.startTime = performance.now(); | ||
var originalOnreadystatechange = this.onreadystatechange; | ||
this.onreadystatechange = function () { | ||
if (this.readyState === XMLHttpRequest.DONE) { | ||
monitor(reportXhr)(); | ||
} | ||
if (originalOnreadystatechange) { | ||
originalOnreadystatechange.apply(this, arguments); | ||
} | ||
}; | ||
var hasBeenReported = false; | ||
var reportXhr = function () { | ||
if (hasBeenReported) { | ||
return; | ||
} | ||
hasBeenReported = true; | ||
_this._datadog_xhr.duration = performance.now() - _this._datadog_xhr.startTime; | ||
_this._datadog_xhr.response = _this.response; | ||
_this._datadog_xhr.status = _this.status; | ||
onRequestCompleteCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr); }); | ||
}; | ||
this.addEventListener('loadend', monitor(reportXhr)); | ||
beforeSendCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr); }); | ||
if (this._datadog_xhr) { | ||
this._datadog_xhr.startTime = performance.now(); | ||
var originalOnreadystatechange_1 = this.onreadystatechange; | ||
this.onreadystatechange = function () { | ||
if (this.readyState === XMLHttpRequest.DONE) { | ||
monitor(reportXhr_1)(); | ||
} | ||
if (originalOnreadystatechange_1) { | ||
originalOnreadystatechange_1.apply(this, arguments); | ||
} | ||
}; | ||
var hasBeenReported_1 = false; | ||
var reportXhr_1 = function () { | ||
if (hasBeenReported_1) { | ||
return; | ||
} | ||
hasBeenReported_1 = true; | ||
_this._datadog_xhr.duration = performance.now() - _this._datadog_xhr.startTime; | ||
_this._datadog_xhr.response = _this.response; | ||
_this._datadog_xhr.status = _this.status; | ||
onRequestCompleteCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr); }); | ||
}; | ||
this.addEventListener('loadend', monitor(reportXhr_1)); | ||
beforeSendCallbacks.forEach(function (callback) { return callback(_this._datadog_xhr); }); | ||
} | ||
return originalXhrSend.apply(this, arguments); | ||
}; | ||
}); | ||
} | ||
//# sourceMappingURL=xhrProxy.js.map |
{ | ||
"name": "@datadog/browser-core", | ||
"version": "1.15.0", | ||
"version": "1.15.1", | ||
"license": "Apache-2.0", | ||
@@ -26,3 +26,3 @@ "main": "cjs/index.js", | ||
}, | ||
"gitHead": "ec0779221049b205cd64bdb4ec838f39ea1ac0c9" | ||
"gitHead": "7d7cef5e04a1cffeb5773501b77b3b63e7709691" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
379709
6321