MCPcopy
hub / github.com/react/create-react-app / InfoAjax

Function InfoAjax

packages/react-error-overlay/fixtures/bundle_u.mjs:11276–11302  ·  view source on GitHub ↗
(url, AjaxObject)

Source from the content-addressed store, hash-verified

11274}
11275
11276function InfoAjax(url, AjaxObject) {
11277 EventEmitter.call(this);
11278
11279 var self = this;
11280 var t0 = +new Date();
11281 this.xo = new AjaxObject('GET', url);
11282
11283 this.xo.once('finish', function(status, text) {
11284 var info, rtt;
11285 if (status === 200) {
11286 rtt = (+new Date()) - t0;
11287 if (text) {
11288 try {
11289 info = JSON3.parse(text);
11290 } catch (e) {
11291 debug('bad json', text);
11292 }
11293 }
11294
11295 if (!objectUtils.isObject(info)) {
11296 info = {};
11297 }
11298 }
11299 self.emit('finish', info, rtt);
11300 self.removeAllListeners();
11301 });
11302}
11303
11304inherits(InfoAjax, EventEmitter);
11305

Callers

nothing calls this directly

Calls 1

debugFunction · 0.70

Tested by

no test coverage detected