mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-08 00:33:12 +00:00
check presence of window before using it and appease ts types
This commit is contained in:
parent
565ffb18fb
commit
9cf2924f7b
@ -11,7 +11,11 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const crypto = window.crypto || window.msCrypto || nodeCrypto.webcrypto;
|
const crypto =
|
||||||
|
(typeof window !== "undefined" &&
|
||||||
|
(window as Window) &&
|
||||||
|
(window.crypto || window.msCrypto)) ||
|
||||||
|
(nodeCrypto.webcrypto as unknown as Crypto);
|
||||||
const subtle: SubtleCrypto = crypto.subtle || crypto.webkitSubtle;
|
const subtle: SubtleCrypto = crypto.subtle || crypto.webkitSubtle;
|
||||||
|
|
||||||
if (subtle === undefined) {
|
if (subtle === undefined) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user