Compare commits

..

3 Commits

4 changed files with 18 additions and 6 deletions

View File

@ -10,5 +10,5 @@ esbuild.buildSync({
define: {
global: "self",
},
inject: ["process.js"],
inject: ["process.js", "polyfill.js"],
});

View File

@ -15,9 +15,10 @@
"dependencies": {
"@lumeweb/hyperswarm-web": "git+https://git.lumeweb.com/LumeWeb/hyperswarm-web.git",
"@noble/ed25519": "^1.7.3",
"@peculiar/webcrypto": "^1.4.3",
"b4a": "^1.6.3",
"eventemitter2": "^6.4.9",
"hyperswarm": "^4.3.7",
"hyperswarm": "^4.4.0",
"libkmodule": "^0.2.53",
"libskynet": "^0.0.62",
"noise-handshake": "^3.0.2",
@ -28,7 +29,7 @@
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-typescript": "^8.5.0",
"@screamingvoid/sodium-universal": "^0.1.1",
"@scure/bip39": "^1.1.1",
"@scure/bip39": "^1.2.0",
"@skynetlabs/skynet-nodejs": "^2.9.0",
"@types/b4a": "^1.6.0",
"@types/jest": "^28.1.8",
@ -41,7 +42,7 @@
"jest": "^28.1.3",
"jest-puppeteer": "^6.2.0",
"libskynetnode": "^0.1.4",
"prettier": "^2.8.4",
"prettier": "^2.8.7",
"process": "^0.11.10",
"puppeteer": "^15.5.0",
"random-number-csprng": "^1.0.2",
@ -51,7 +52,7 @@
"stream-browserify": "^3.0.0",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"webpack": "^5.76.2",
"webpack": "^5.77.0",
"webpack-cli": "^4.10.0"
},
"browser": {

11
polyfill.js Normal file
View File

@ -0,0 +1,11 @@
import { Crypto } from "@peculiar/webcrypto";
let globalCrypto = self.crypto;
if (!globalCrypto.subtle) {
let subtleCrypto = new Crypto().subtle;
Object.defineProperty(globalCrypto, "subtle", {
get() {
return subtleCrypto;
},
});
}

View File

@ -359,7 +359,7 @@ async function handleListenConnections(aq: ActiveQuery) {
};
const hookClose = () => {
swarm.onceSelf("close", closeCb);
swarmEvent?.once("close", closeCb);
};
if (swarm.activeRelay) {