ethers.js/packages/providers/lib/browser-ws.js

22 lines
694 B
JavaScript
Raw Permalink Normal View History

2020-03-12 19:14:50 +01:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
2021-03-07 18:24:04 -05:00
exports.WebSocket = void 0;
2020-03-12 19:14:50 +01:00
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
2020-04-18 05:14:55 -04:00
var WS = null;
2020-11-16 23:07:24 -05:00
exports.WebSocket = WS;
2020-04-18 05:14:55 -04:00
try {
2020-11-16 23:07:24 -05:00
exports.WebSocket = WS = WebSocket;
2020-04-18 05:14:55 -04:00
if (WS == null) {
throw new Error("inject please");
}
}
catch (error) {
2020-03-12 19:14:50 +01:00
var logger_2 = new logger_1.Logger(_version_1.version);
2020-11-16 23:07:24 -05:00
exports.WebSocket = WS = function () {
2020-03-12 19:14:50 +01:00
logger_2.throwError("WebSockets not supported in this environment", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "new WebSocket()"
});
};
}
2020-07-13 08:03:56 -04:00
//# sourceMappingURL=browser-ws.js.map