UNPKG

@tapsioss/client-socket-manager

Version:
23 lines (22 loc) 813 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.warnDisposedClient = exports.assertCallbackType = exports.isBrowser = void 0; const isBrowser = () => typeof document !== "undefined"; exports.isBrowser = isBrowser; const assertCallbackType = (cb, message) => { if (typeof cb !== "function") { throw new TypeError(`ClientSocketManager: ${message}`); } return true; }; exports.assertCallbackType = assertCallbackType; const warnDisposedClient = (isDisposed) => { if (!isDisposed) return; // eslint-disable-next-line no-console console.warn([ "ClientSocketManager: Attempted to use a disposed client.", "Please reassign the client with a new instance.", ].join(" ")); }; exports.warnDisposedClient = warnDisposedClient;