"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dist/socket.io.js" between
socket.io-client-4.5.1.tar.gz and socket.io-client-4.5.2.tar.gz

About: Socket.IO client is a Javascript client library for the browser (or a Node.js client) that enables real-time communication with an Socket.IO server.

socket.io.js  (socket.io-client-4.5.1):socket.io.js  (socket.io-client-4.5.2)
/*! /*!
* Socket.IO v4.5.1 * Socket.IO v4.5.2
* (c) 2014-2022 Guillermo Rauch * (c) 2014-2022 Guillermo Rauch
* Released under the MIT License. * Released under the MIT License.
*/ */
(function (global, factory) { (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) : typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, glo bal.io = factory()); (global = typeof globalThis !== 'undefined' ? globalThis : global || self, glo bal.io = factory());
})(this, (function () { 'use strict'; })(this, (function () { 'use strict';
function _typeof(obj) { function _typeof(obj) {
"@babel/helpers - typeof"; "@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.it
_typeof = function (obj) { erator ? function (obj) {
return typeof obj; return typeof obj;
}; } : function (obj) {
} else { return obj && "function" == typeof Symbol && obj.constructor === Symbol &&
_typeof = function (obj) { obj !== Symbol.prototype ? "symbol" : typeof obj;
return obj && typeof Symbol === "function" && obj.constructor === Symbol }, _typeof(obj);
&& obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
} }
function _classCallCheck(instance, Constructor) { function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) { if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function"); throw new TypeError("Cannot call a class as a function");
} }
} }
function _defineProperties(target, props) { function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) { for (var i = 0; i < props.length; i++) {
skipping to change at line 47 skipping to change at line 41
descriptor.enumerable = descriptor.enumerable || false; descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true; descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true; if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor); Object.defineProperty(target, descriptor.key, descriptor);
} }
} }
function _createClass(Constructor, protoProps, staticProps) { function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps); if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor; return Constructor;
} }
function _extends() { function _extends() {
_extends = Object.assign || function (target) { _extends = Object.assign ? Object.assign.bind() : function (target) {
for (var i = 1; i < arguments.length; i++) { for (var i = 1; i < arguments.length; i++) {
var source = arguments[i]; var source = arguments[i];
for (var key in source) { for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) { if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key]; target[key] = source[key];
} }
} }
} }
return target; return target;
}; };
return _extends.apply(this, arguments); return _extends.apply(this, arguments);
} }
function _inherits(subClass, superClass) { function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) { if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function"); throw new TypeError("Super expression must either be null or a function");
} }
subClass.prototype = Object.create(superClass && superClass.prototype, { subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: { constructor: {
value: subClass, value: subClass,
writable: true, writable: true,
configurable: true configurable: true
} }
}); });
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass); if (superClass) _setPrototypeOf(subClass, superClass);
} }
function _getPrototypeOf(o) { function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _ getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : fun ction _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o); return o.__proto__ || Object.getPrototypeOf(o);
}; };
return _getPrototypeOf(o); return _getPrototypeOf(o);
} }
function _setPrototypeOf(o, p) { function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : fun ction _setPrototypeOf(o, p) {
o.__proto__ = p; o.__proto__ = p;
return o; return o;
}; };
return _setPrototypeOf(o, p); return _setPrototypeOf(o, p);
} }
function _isNativeReflectConstruct() { function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false; if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true; if (typeof Proxy === "function") return true;
try { try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true; return true;
} catch (e) { } catch (e) {
return false; return false;
} }
} }
function _construct(Parent, args, Class) { function _construct(Parent, args, Class) {
if (_isNativeReflectConstruct()) { if (_isNativeReflectConstruct()) {
_construct = Reflect.construct; _construct = Reflect.construct.bind();
} else { } else {
_construct = function _construct(Parent, args, Class) { _construct = function _construct(Parent, args, Class) {
var a = [null]; var a = [null];
a.push.apply(a, args); a.push.apply(a, args);
var Constructor = Function.bind.apply(Parent, a); var Constructor = Function.bind.apply(Parent, a);
var instance = new Constructor(); var instance = new Constructor();
if (Class) _setPrototypeOf(instance, Class.prototype); if (Class) _setPrototypeOf(instance, Class.prototype);
return instance; return instance;
}; };
} }
skipping to change at line 213 skipping to change at line 211
function _superPropBase(object, property) { function _superPropBase(object, property) {
while (!Object.prototype.hasOwnProperty.call(object, property)) { while (!Object.prototype.hasOwnProperty.call(object, property)) {
object = _getPrototypeOf(object); object = _getPrototypeOf(object);
if (object === null) break; if (object === null) break;
} }
return object; return object;
} }
function _get(target, property, receiver) { function _get() {
if (typeof Reflect !== "undefined" && Reflect.get) { if (typeof Reflect !== "undefined" && Reflect.get) {
_get = Reflect.get; _get = Reflect.get.bind();
} else { } else {
_get = function _get(target, property, receiver) { _get = function _get(target, property, receiver) {
var base = _superPropBase(target, property); var base = _superPropBase(target, property);
if (!base) return; if (!base) return;
var desc = Object.getOwnPropertyDescriptor(base, property); var desc = Object.getOwnPropertyDescriptor(base, property);
if (desc.get) { if (desc.get) {
return desc.get.call(receiver); return desc.get.call(arguments.length < 3 ? target : receiver);
} }
return desc.value; return desc.value;
}; };
} }
return _get(target, property, receiver || target); return _get.apply(this, arguments);
} }
function _unsupportedIterableToArray(o, minLen) { function _unsupportedIterableToArray(o, minLen) {
if (!o) return; if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen); if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1); var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o); if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
} }
skipping to change at line 365 skipping to change at line 363
var fileReader = new FileReader(); var fileReader = new FileReader();
fileReader.onload = function () { fileReader.onload = function () {
var content = fileReader.result.split(",")[1]; var content = fileReader.result.split(",")[1];
callback("b" + content); callback("b" + content);
}; };
return fileReader.readAsDataURL(data); return fileReader.readAsDataURL(data);
}; };
/*
* base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
* Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
* Released under MIT License
*/
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' ; // Use a lookup table to find the index. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' ; // Use a lookup table to find the index.
var lookup$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256); var lookup$1 = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
for (var i$1 = 0; i$1 < chars.length; i$1++) { for (var i$1 = 0; i$1 < chars.length; i$1++) {
lookup$1[chars.charCodeAt(i$1)] = i$1; lookup$1[chars.charCodeAt(i$1)] = i$1;
} }
var decode$1 = function decode(base64) { var decode$1 = function decode(base64) {
var bufferLength = base64.length * 0.75, var bufferLength = base64.length * 0.75,
len = base64.length, len = base64.length,
i, i,
p = 0, p = 0,
encoded1, encoded1,
encoded2, encoded2,
encoded3, encoded3,
encoded4; encoded4;
skipping to change at line 660 skipping to change at line 652
* *
* @param {String} event * @param {String} event
* @return {Boolean} * @return {Boolean}
* @api public * @api public
*/ */
Emitter.prototype.hasListeners = function (event) { Emitter.prototype.hasListeners = function (event) {
return !!this.listeners(event).length; return !!this.listeners(event).length;
}; };
var globalThis = (function () { var globalThisShim = function () {
if (typeof self !== "undefined") { if (typeof self !== "undefined") {
return self; return self;
} else if (typeof window !== "undefined") { } else if (typeof window !== "undefined") {
return window; return window;
} else { } else {
return Function("return this")(); return Function("return this")();
} }
})(); }();
function pick(obj) { function pick(obj) {
for (var _len = arguments.length, attr = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { for (var _len = arguments.length, attr = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
attr[_key - 1] = arguments[_key]; attr[_key - 1] = arguments[_key];
} }
return attr.reduce(function (acc, k) { return attr.reduce(function (acc, k) {
if (obj.hasOwnProperty(k)) { if (obj.hasOwnProperty(k)) {
acc[k] = obj[k]; acc[k] = obj[k];
} }
return acc; return acc;
}, {}); }, {});
} // Keep a reference to the real timeout functions so they can be used when o verridden } // Keep a reference to the real timeout functions so they can be used when o verridden
var NATIVE_SET_TIMEOUT = setTimeout; var NATIVE_SET_TIMEOUT = setTimeout;
var NATIVE_CLEAR_TIMEOUT = clearTimeout; var NATIVE_CLEAR_TIMEOUT = clearTimeout;
function installTimerFunctions(obj, opts) { function installTimerFunctions(obj, opts) {
if (opts.useNativeTimers) { if (opts.useNativeTimers) {
obj.setTimeoutFn = NATIVE_SET_TIMEOUT.bind(globalThis); obj.setTimeoutFn = NATIVE_SET_TIMEOUT.bind(globalThisShim);
obj.clearTimeoutFn = NATIVE_CLEAR_TIMEOUT.bind(globalThis); obj.clearTimeoutFn = NATIVE_CLEAR_TIMEOUT.bind(globalThisShim);
} else { } else {
obj.setTimeoutFn = setTimeout.bind(globalThis); obj.setTimeoutFn = setTimeout.bind(globalThisShim);
obj.clearTimeoutFn = clearTimeout.bind(globalThis); obj.clearTimeoutFn = clearTimeout.bind(globalThisShim);
} }
} // base64 encoded buffers are about 33% bigger (https://en.wikipedia.org/wik i/Base64) } // base64 encoded buffers are about 33% bigger (https://en.wikipedia.org/wik i/Base64)
var BASE64_OVERHEAD = 1.33; // we could also have used `new Blob([obj]).size`, but it isn't supported in IE9 var BASE64_OVERHEAD = 1.33; // we could also have used `new Blob([obj]).size`, but it isn't supported in IE9
function byteLength(obj) { function byteLength(obj) {
if (typeof obj === "string") { if (typeof obj === "string") {
return utf8Length(obj); return utf8Length(obj);
} // arraybuffer or blob } // arraybuffer or blob
skipping to change at line 745 skipping to change at line 737
_classCallCheck(this, TransportError); _classCallCheck(this, TransportError);
_this = _super.call(this, reason); _this = _super.call(this, reason);
_this.description = description; _this.description = description;
_this.context = context; _this.context = context;
_this.type = "TransportError"; _this.type = "TransportError";
return _this; return _this;
} }
return TransportError; return _createClass(TransportError);
}( /*#__PURE__*/_wrapNativeSuper(Error)); }( /*#__PURE__*/_wrapNativeSuper(Error));
var Transport = /*#__PURE__*/function (_Emitter) { var Transport = /*#__PURE__*/function (_Emitter) {
_inherits(Transport, _Emitter); _inherits(Transport, _Emitter);
var _super2 = _createSuper(Transport); var _super2 = _createSuper(Transport);
/** /**
* Transport abstract constructor. * Transport abstract constructor.
* *
skipping to change at line 989 skipping to change at line 981
try { try {
value = typeof XMLHttpRequest !== 'undefined' && 'withCredentials' in new XM LHttpRequest(); value = typeof XMLHttpRequest !== 'undefined' && 'withCredentials' in new XM LHttpRequest();
} catch (err) {// if XMLHttp support is disabled in IE then it will throw } catch (err) {// if XMLHttp support is disabled in IE then it will throw
// when trying to create // when trying to create
} }
var hasCORS = value; var hasCORS = value;
// browser shim for xmlhttprequest module // browser shim for xmlhttprequest module
function XMLHttpRequest$1 (opts) { function XHR(opts) {
var xdomain = opts.xdomain; // XMLHttpRequest can be disabled on IE var xdomain = opts.xdomain; // XMLHttpRequest can be disabled on IE
try { try {
if ("undefined" !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { if ("undefined" !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {
return new XMLHttpRequest(); return new XMLHttpRequest();
} }
} catch (e) {} } catch (e) {}
if (!xdomain) { if (!xdomain) {
try { try {
return new globalThis[["Active"].concat("Object").join("X")]("Microsoft. XMLHTTP"); return new globalThisShim[["Active"].concat("Object").join("X")]("Micros oft.XMLHTTP");
} catch (e) {} } catch (e) {}
} }
} }
function empty() {} function empty() {}
var hasXHR2 = function () { var hasXHR2 = function () {
var xhr = new XMLHttpRequest$1({ var xhr = new XHR({
xdomain: false xdomain: false
}); });
return null != xhr.responseType; return null != xhr.responseType;
}(); }();
var Polling = /*#__PURE__*/function (_Transport) { var Polling = /*#__PURE__*/function (_Transport) {
_inherits(Polling, _Transport); _inherits(Polling, _Transport);
var _super = _createSuper(Polling); var _super = _createSuper(Polling);
skipping to change at line 1346 skipping to change at line 1338
*/ */
_createClass(Request, [{ _createClass(Request, [{
key: "create", key: "create",
value: function create() { value: function create() {
var _this9 = this; var _this9 = this;
var opts = pick(this.opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref"); var opts = pick(this.opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
opts.xdomain = !!this.opts.xd; opts.xdomain = !!this.opts.xd;
opts.xscheme = !!this.opts.xs; opts.xscheme = !!this.opts.xs;
var xhr = this.xhr = new XMLHttpRequest$1(opts); var xhr = this.xhr = new XHR(opts);
try { try {
xhr.open(this.method, this.uri, this.async); xhr.open(this.method, this.uri, this.async);
try { try {
if (this.opts.extraHeaders) { if (this.opts.extraHeaders) {
xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true); xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);
for (var i in this.opts.extraHeaders) { for (var i in this.opts.extraHeaders) {
if (this.opts.extraHeaders.hasOwnProperty(i)) { if (this.opts.extraHeaders.hasOwnProperty(i)) {
skipping to change at line 1496 skipping to change at line 1488
* memory leaks (e.g. when using IE) and to ensure that no spurious error is * memory leaks (e.g. when using IE) and to ensure that no spurious error is
* emitted. * emitted.
*/ */
if (typeof document !== "undefined") { if (typeof document !== "undefined") {
// @ts-ignore // @ts-ignore
if (typeof attachEvent === "function") { if (typeof attachEvent === "function") {
// @ts-ignore // @ts-ignore
attachEvent("onunload", unloadHandler); attachEvent("onunload", unloadHandler);
} else if (typeof addEventListener === "function") { } else if (typeof addEventListener === "function") {
var terminationEvent = "onpagehide" in globalThis ? "pagehide" : "unload"; var terminationEvent = "onpagehide" in globalThisShim ? "pagehide" : "unlo ad";
addEventListener(terminationEvent, unloadHandler, false); addEventListener(terminationEvent, unloadHandler, false);
} }
} }
function unloadHandler() { function unloadHandler() {
for (var i in Request.requests) { for (var i in Request.requests) {
if (Request.requests.hasOwnProperty(i)) { if (Request.requests.hasOwnProperty(i)) {
Request.requests[i].abort(); Request.requests[i].abort();
} }
} }
skipping to change at line 1522 skipping to change at line 1514
if (isPromiseAvailable) { if (isPromiseAvailable) {
return function (cb) { return function (cb) {
return Promise.resolve().then(cb); return Promise.resolve().then(cb);
}; };
} else { } else {
return function (cb, setTimeoutFn) { return function (cb, setTimeoutFn) {
return setTimeoutFn(cb, 0); return setTimeoutFn(cb, 0);
}; };
} }
}(); }();
var WebSocket = globalThis.WebSocket || globalThis.MozWebSocket; var WebSocket = globalThisShim.WebSocket || globalThisShim.MozWebSocket;
var usingBrowserWebSocket = true; var usingBrowserWebSocket = true;
var defaultBinaryType = "arraybuffer"; var defaultBinaryType = "arraybuffer";
var isReactNative = typeof navigator !== "undefined" && typeof navigator.produ ct === "string" && navigator.product.toLowerCase() === "reactnative"; var isReactNative = typeof navigator !== "undefined" && typeof navigator.produ ct === "string" && navigator.product.toLowerCase() === "reactnative";
var WS = /*#__PURE__*/function (_Transport) { var WS = /*#__PURE__*/function (_Transport) {
_inherits(WS, _Transport); _inherits(WS, _Transport);
var _super = _createSuper(WS); var _super = _createSuper(WS);
/** /**
skipping to change at line 1724 skipping to change at line 1716
/** /**
* Feature detection for WebSocket. * Feature detection for WebSocket.
* *
* @return {Boolean} whether this transport is available. * @return {Boolean} whether this transport is available.
* @api public * @api public
*/ */
}, { }, {
key: "check", key: "check",
value: function check() { value: function check() {
return !!WebSocket && !("__initialize" in WebSocket && this.name === WS. prototype.name); return !!WebSocket;
} }
}]); }]);
return WS; return WS;
}(Transport); }(Transport);
var transports = { var transports = {
websocket: WS, websocket: WS,
polling: Polling polling: Polling
}; };
skipping to change at line 2471 skipping to change at line 2463
} }
return filteredUpgrades; return filteredUpgrades;
} }
}]); }]);
return Socket; return Socket;
}(Emitter); }(Emitter);
Socket$1.protocol = protocol$1; Socket$1.protocol = protocol$1;
Socket$1.protocol;
/** /**
* URL parser. * URL parser.
* *
* @param uri - url * @param uri - url
* @param path - the request path of the connection * @param path - the request path of the connection
* @param loc - An object meant to mimic window.location. * @param loc - An object meant to mimic window.location.
* Defaults to window.location. * Defaults to window.location.
* @public * @public
*/ */
skipping to change at line 3162 skipping to change at line 3156
* If the event is in `events`, it's emitted normally. * If the event is in `events`, it's emitted normally.
* *
* @return self * @return self
* @public * @public
*/ */
}, { }, {
key: "emit", key: "emit",
value: function emit(ev) { value: function emit(ev) {
if (RESERVED_EVENTS.hasOwnProperty(ev)) { if (RESERVED_EVENTS.hasOwnProperty(ev)) {
throw new Error('"' + ev + '" is a reserved event name'); throw new Error('"' + ev.toString() + '" is a reserved event name');
} }
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2]; args[_key2 - 1] = arguments[_key2];
} }
args.unshift(ev); args.unshift(ev);
var packet = { var packet = {
type: PacketType.EVENT, type: PacketType.EVENT,
data: args data: args
skipping to change at line 4127 skipping to change at line 4121
} }
/** /**
* Called with data. * Called with data.
* *
* @private * @private
*/ */
}, { }, {
key: "ondata", key: "ondata",
value: function ondata(data) { value: function ondata(data) {
this.decoder.add(data); try {
this.decoder.add(data);
} catch (e) {
this.onclose("parse error");
}
} }
/** /**
* Called when parser fully decodes a packet. * Called when parser fully decodes a packet.
* *
* @private * @private
*/ */
}, { }, {
key: "ondecoded", key: "ondecoded",
value: function ondecoded(packet) { value: function ondecoded(packet) {
 End of changes. 31 change blocks. 
45 lines changed or deleted 44 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)