websocket-constructor.browser.js 866 B

12345678910111213141516171819
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. exports.defaultBinaryType = exports.usingBrowserWebSocket = exports.WebSocket = exports.nextTick = void 0;
  7. const globalThis_js_1 = __importDefault(require("../globalThis.js"));
  8. exports.nextTick = (() => {
  9. const isPromiseAvailable = typeof Promise === "function" && typeof Promise.resolve === "function";
  10. if (isPromiseAvailable) {
  11. return cb => Promise.resolve().then(cb);
  12. }
  13. else {
  14. return (cb, setTimeoutFn) => setTimeoutFn(cb, 0);
  15. }
  16. })();
  17. exports.WebSocket = globalThis_js_1.default.WebSocket || globalThis_js_1.default.MozWebSocket;
  18. exports.usingBrowserWebSocket = true;
  19. exports.defaultBinaryType = "arraybuffer";