Comparing version 1.0.1 to 1.0.2
# isows | ||
## 1.0.1 | ||
## 1.0.2 | ||
### Patch Changes | ||
- [`c0c0e87`](https://github.com/wagmi-dev/isows/commit/c0c0e8724407a989da70bfff29cf444ccbf31b84) Thanks [@jxom](https://github.com/jxom)! - Removed `"module"` from `package.json`. | ||
- [`59ccdf9`](https://github.com/wagmi-dev/isows/commit/59ccdf9a45900a5854b010f58bf4a6f11169c23f) Thanks [@jxom](https://github.com/jxom)! - Added `"deno"` conditional export. | ||
@@ -8,0 +10,0 @@ |
10
index.ts
@@ -5,7 +5,7 @@ import { WebSocket as WebSocketNode_ } from "ws"; | ||
export const WebSocket = (() => { | ||
try { | ||
return getNativeWebSocket(); | ||
} catch { | ||
return WebSocketNode_; | ||
} | ||
try { | ||
return getNativeWebSocket(); | ||
} catch { | ||
return WebSocketNode_; | ||
} | ||
})(); |
{ | ||
"name": "isows", | ||
"description": "Isomorphic WebSocket", | ||
"version": "1.0.1", | ||
"type": "module", | ||
"version": "1.0.2", | ||
"browser": "./_esm/native.js", | ||
@@ -7,0 +6,0 @@ "main": "./_cjs/index.js", |
10
utils.ts
export function getNativeWebSocket() { | ||
if (typeof WebSocket !== "undefined") return WebSocket; | ||
if (typeof global.WebSocket !== "undefined") return global.WebSocket; | ||
if (typeof window.WebSocket !== "undefined") return window.WebSocket; | ||
if (typeof self.WebSocket !== "undefined") return self.WebSocket; | ||
throw new Error("`WebSocket` is not supported in this environment"); | ||
if (typeof WebSocket !== "undefined") return WebSocket; | ||
if (typeof global.WebSocket !== "undefined") return global.WebSocket; | ||
if (typeof window.WebSocket !== "undefined") return window.WebSocket; | ||
if (typeof self.WebSocket !== "undefined") return self.WebSocket; | ||
throw new Error("`WebSocket` is not supported in this environment"); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9367
27
103
No