Compare commits

...

6 Commits

Author SHA1 Message Date
Derrick Hammer e643f14e90
*Update dist 2022-11-16 12:16:08 -05:00
Derrick Hammer 4f08c07489
*Define constructor bag types 2022-11-16 12:15:51 -05:00
Derrick Hammer 73846a5eda
Revert "*Explicitly define protocol as a bag option"
This reverts commit cea5ba5131.
2022-11-16 12:13:00 -05:00
Derrick Hammer b02a7f5a2c
Revert "*Update dist"
This reverts commit 129141bd8f.
2022-11-16 12:13:00 -05:00
Derrick Hammer 3b87e81c12
Revert "*Update bag structure"
This reverts commit e446466c2a.
2022-11-16 12:12:52 -05:00
Derrick Hammer e18055e606
Revert "*Update dist"
This reverts commit 898fad7002.
2022-11-16 12:12:52 -05:00
4 changed files with 15 additions and 15 deletions

9
dist/index.d.ts vendored
View File

@ -1,11 +1,12 @@
/// <reference types="node" />
import DHTOnlineBase from "./dhtOnlineBase.js";
export default class DHTOnline extends DHTOnlineBase {
private flood;
private swarm;
constructor(swarm: any, { id, data, protocol, ...opts }?: {
protocol: undefined;
id?: any;
data?: {} | undefined;
constructor(swarm: any, { id, data, ...opts }?: {
id?: Buffer;
data?: {};
opts?: any;
});
handlePeerAdd(peer: any): void;
handlePeerRemove(peer: any): void;

2
dist/index.d.ts.map vendored
View File

@ -1 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAM/C,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,aAAa;IAClD,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,KAAK,CAAM;gBAGjB,KAAK,EAAE,GAAG,EACV,EAAE,EAA4B,EAAE,IAAS,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE;;;;KAE7D;IAmBH,aAAa,CAAC,IAAI,EAAE,GAAG;IAKvB,gBAAgB,CAAC,IAAI,EAAE,GAAG;IAW1B,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM;CAGrC"}
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAK/C,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,aAAa;IAClD,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,KAAK,CAAM;gBAGjB,KAAK,EAAE,GAAG,EACV,EACE,EAA4B,EAC5B,IAAS,EACT,GAAG,IAAI,EACR,GAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAA;KAAO;IAmBhD,aAAa,CAAC,IAAI,EAAE,GAAG;IAKvB,gBAAgB,CAAC,IAAI,EAAE,GAAG;IAW1B,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM;CAGrC"}

6
dist/index.js vendored
View File

@ -9,11 +9,9 @@ const DISCONNECT_SMOOTH = 500;
class DHTOnline extends dhtOnlineBase_js_1.default {
flood;
swarm;
constructor(swarm, { id = swarm.keyPair.publicKey, data = {}, protocol, ...opts } = {
protocol: undefined,
}) {
constructor(swarm, { id = swarm.keyPair.publicKey, data = {}, ...opts } = {}) {
super(id, opts);
this.flood = new dht_flood_1.default({ id, swarm, protocol, ...opts });
this.flood = new dht_flood_1.default({ id, swarm, ...opts });
this.swarm = swarm;
this.flood.on("peer-open", (peer) => this.handlePeerAdd(peer));
this.flood.on("peer-remove", (peer) => this.handlePeerRemove(peer));

View File

@ -1,6 +1,5 @@
import DHTOnlineBase from "./dhtOnlineBase.js";
import DHTFlood from "@lumeweb/dht-flood";
import * as stream from "stream";
const DISCONNECT_SMOOTH = 500;
@ -10,12 +9,14 @@ export default class DHTOnline extends DHTOnlineBase {
constructor(
swarm: any,
{ id = swarm.keyPair.publicKey, data = {}, protocol, ...opts } = {
protocol: undefined,
}
{
id = swarm.keyPair.publicKey,
data = {},
...opts
}: { id?: Buffer; data?: {}; opts?: any } = {}
) {
super(id, opts);
this.flood = new DHTFlood({ id, swarm, protocol, ...opts });
super(id, opts as any);
this.flood = new DHTFlood({ id, swarm, ...opts });
this.swarm = swarm;
this.flood.on("peer-open", (peer) => this.handlePeerAdd(peer));