mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-05-08 11:52:23 +00:00
WIP: use self instead of window for WebWorker compatibility
This commit is contained in:
parent
308ac7cd1a
commit
843b5e33d6
@ -3,12 +3,12 @@
|
|||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
module.exports = function getWebCrypto () {
|
module.exports = function getWebCrypto () {
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof self !== 'undefined') {
|
||||||
// This is only a shim for interfaces, not for functionality
|
// This is only a shim for interfaces, not for functionality
|
||||||
require('webcrypto-shim')(window)
|
require('webcrypto-shim')(self)
|
||||||
|
|
||||||
if (window.crypto) {
|
if (self.crypto) {
|
||||||
return window.crypto
|
return self.crypto
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user