mirror of
https://github.com/fluencelabs/js-libp2p-crypto
synced 2025-05-07 11:52:20 +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'
|
||||
|
||||
module.exports = function getWebCrypto () {
|
||||
if (typeof window !== 'undefined') {
|
||||
if (typeof self !== 'undefined') {
|
||||
// This is only a shim for interfaces, not for functionality
|
||||
require('webcrypto-shim')(window)
|
||||
require('webcrypto-shim')(self)
|
||||
|
||||
if (window.crypto) {
|
||||
return window.crypto
|
||||
if (self.crypto) {
|
||||
return self.crypto
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user