mirror of https://github.com/status-im/js-waku.git
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;
|
||||
|
||||
if (subtle === undefined) {
|
||||
|
|
Loading…
Reference in New Issue