websocket-constructor.browser.js 510 B

12345678910111213
  1. import globalThis from "../globalThis.js";
  2. export const nextTick = (() => {
  3. const isPromiseAvailable = typeof Promise === "function" && typeof Promise.resolve === "function";
  4. if (isPromiseAvailable) {
  5. return cb => Promise.resolve().then(cb);
  6. }
  7. else {
  8. return (cb, setTimeoutFn) => setTimeoutFn(cb, 0);
  9. }
  10. })();
  11. export const WebSocket = globalThis.WebSocket || globalThis.MozWebSocket;
  12. export const usingBrowserWebSocket = true;
  13. export const defaultBinaryType = "arraybuffer";