MCPcopy Index your code
hub / github.com/socketio/socket.io / encodePacket

Function encodePacket

client-dist/socket.io.js:294–312  ·  view source on GitHub ↗
(_ref, supportsBinary, callback)

Source from the content-addressed store, hash-verified

292 return typeof ArrayBuffer.isView === "function" ? ArrayBuffer.isView(obj) : obj && obj.buffer instanceof ArrayBuffer;
293 };
294 var encodePacket = function encodePacket(_ref, supportsBinary, callback) {
295 var type = _ref.type,
296 data = _ref.data;
297 if (withNativeBlob$1 && data instanceof Blob) {
298 if (supportsBinary) {
299 return callback(data);
300 } else {
301 return encodeBlobAsBase64(data, callback);
302 }
303 } else if (withNativeArrayBuffer$2 && (data instanceof ArrayBuffer || isView$1(data))) {
304 if (supportsBinary) {
305 return callback(data);
306 } else {
307 return encodeBlobAsBase64(new Blob([data]), callback);
308 }
309 }
310 // plain string
311 return callback(PACKET_TYPES[type] + (data || ""));
312 };
313 var encodeBlobAsBase64 = function encodeBlobAsBase64(data, callback) {
314 var fileReader = new FileReader();
315 fileReader.onload = function () {

Callers 3

encodePacketToBinaryFunction · 0.85
encodePayloadFunction · 0.85
_loopFunction · 0.85

Calls 3

callbackFunction · 0.85
encodeBlobAsBase64Function · 0.85
isView$1Function · 0.85

Tested by

no test coverage detected