ws-browser.ts 329 B

1234567891011
  1. function getGlobal(): any {
  2. if (typeof self !== 'undefined') { return self; }
  3. if (typeof window !== 'undefined') { return window; }
  4. if (typeof global !== 'undefined') { return global; }
  5. throw new Error('unable to locate global object');
  6. };
  7. const _WebSocket = getGlobal().WebSocket;
  8. export { _WebSocket as WebSocket };