18 lines
408 B
TypeScript
18 lines
408 B
TypeScript
|
"use strict";
|
||
|
|
||
|
import { Logger } from "@ethersproject/logger";
|
||
|
import { version } from "./_version";
|
||
|
|
||
|
let WS = (WebSocket as any);
|
||
|
|
||
|
if (WS == null) {
|
||
|
const logger = new Logger(version);
|
||
|
WS = function() {
|
||
|
logger.throwError("WebSockets not supported in this environment", Logger.errors.UNSUPPORTED_OPERATION, {
|
||
|
operation: "new WebSocket()"
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = WS;
|