Gazebo_simulation-Frontend/node_modules/.cache/babel-loader/9734b681ada22c620e4ef6fbc58363ff.json
2020-12-31 20:18:50 +00:00

1 line
1.7 KiB
JSON

{"ast":null,"code":"'use strict';\n\nvar inherits = require('inherits'),\n EventEmitter = require('events').EventEmitter,\n EventSourceDriver = require('eventsource');\n\nvar debug = function debug() {};\n\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:receiver:eventsource');\n}\n\nfunction EventSourceReceiver(url) {\n debug(url);\n EventEmitter.call(this);\n var self = this;\n var es = this.es = new EventSourceDriver(url);\n\n es.onmessage = function (e) {\n debug('message', e.data);\n self.emit('message', decodeURI(e.data));\n };\n\n es.onerror = function (e) {\n debug('error', es.readyState, e); // ES on reconnection has readyState = 0 or 1.\n // on network error it's CLOSED = 2\n\n var reason = es.readyState !== 2 ? 'network' : 'permanent';\n\n self._cleanup();\n\n self._close(reason);\n };\n}\n\ninherits(EventSourceReceiver, EventEmitter);\n\nEventSourceReceiver.prototype.abort = function () {\n debug('abort');\n\n this._cleanup();\n\n this._close('user');\n};\n\nEventSourceReceiver.prototype._cleanup = function () {\n debug('cleanup');\n var es = this.es;\n\n if (es) {\n es.onmessage = es.onerror = null;\n es.close();\n this.es = null;\n }\n};\n\nEventSourceReceiver.prototype._close = function (reason) {\n debug('close', reason);\n var self = this; // Safari and chrome < 15 crash if we close window before\n // waiting for ES cleanup. See:\n // https://code.google.com/p/chromium/issues/detail?id=89155\n\n setTimeout(function () {\n self.emit('close', null, reason);\n self.removeAllListeners();\n }, 200);\n};\n\nmodule.exports = EventSourceReceiver;","map":null,"metadata":{},"sourceType":"script"}