mirror of
https://github.com/amark/gun.git
synced 2025-06-07 14:46:44 +00:00
Fixed Webpack issues.
This commit is contained in:
parent
795d60983f
commit
a9fd953ab8
4
sea.js
4
sea.js
@ -22,7 +22,7 @@
|
|||||||
let crypto
|
let crypto
|
||||||
let funcsSetter
|
let funcsSetter
|
||||||
|
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof __webpack_require__ === 'function' || typeof window !== 'undefined') {
|
||||||
const wc = window.crypto || window.msCrypto // STD or M$
|
const wc = window.crypto || window.msCrypto // STD or M$
|
||||||
subtle = wc.subtle || wc.webkitSubtle // STD or iSafari
|
subtle = wc.subtle || wc.webkitSubtle // STD or iSafari
|
||||||
getRandomBytes = (len) => Buffer.from(wc.getRandomValues(new Uint8Array(Buffer.alloc(len))))
|
getRandomBytes = (len) => Buffer.from(wc.getRandomValues(new Uint8Array(Buffer.alloc(len))))
|
||||||
@ -47,7 +47,7 @@
|
|||||||
}
|
}
|
||||||
const { TextEncoder, TextDecoder, sessionStorage, localStorage } = funcsSetter()
|
const { TextEncoder, TextDecoder, sessionStorage, localStorage } = funcsSetter()
|
||||||
|
|
||||||
if (typeof global !== 'undefined') {
|
if (typeof __webpack_require__ !== 'function' && typeof global !== 'undefined') {
|
||||||
global.sessionStorage = sessionStorage
|
global.sessionStorage = sessionStorage
|
||||||
global.localStorage = localStorage
|
global.localStorage = localStorage
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user