Compare commits
2 Commits
cf6e0a986f
...
129141bd8f
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | 129141bd8f | |
Derrick Hammer | cea5ba5131 |
|
@ -2,9 +2,10 @@ import DHTOnlineBase from "./dhtOnlineBase.js";
|
||||||
export default class DHTOnline extends DHTOnlineBase {
|
export default class DHTOnline extends DHTOnlineBase {
|
||||||
private flood;
|
private flood;
|
||||||
private swarm;
|
private swarm;
|
||||||
constructor(swarm: any, { id, data, ...opts }?: {
|
constructor(swarm: any, { id, data, protocol, ...opts }?: {
|
||||||
id?: any;
|
id?: any;
|
||||||
data?: {} | undefined;
|
data?: {} | undefined;
|
||||||
|
protocol?: undefined;
|
||||||
});
|
});
|
||||||
handlePeerAdd(peer: any): void;
|
handlePeerAdd(peer: any): void;
|
||||||
handlePeerRemove(peer: any): void;
|
handlePeerRemove(peer: any): void;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"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,EAAE,EAA4B,EAAE,IAAS,EAAE,GAAG,IAAI,EAAE;;;KAAK;IAmB3D,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,QAAoB,EACpB,GAAG,IAAI,EACR;;;;KAAK;IAmBR,aAAa,CAAC,IAAI,EAAE,GAAG;IAKvB,gBAAgB,CAAC,IAAI,EAAE,GAAG;IAW1B,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM;CAGrC"}
|
|
@ -9,9 +9,9 @@ const DISCONNECT_SMOOTH = 500;
|
||||||
class DHTOnline extends dhtOnlineBase_js_1.default {
|
class DHTOnline extends dhtOnlineBase_js_1.default {
|
||||||
flood;
|
flood;
|
||||||
swarm;
|
swarm;
|
||||||
constructor(swarm, { id = swarm.keyPair.publicKey, data = {}, ...opts } = {}) {
|
constructor(swarm, { id = swarm.keyPair.publicKey, data = {}, protocol = undefined, ...opts } = {}) {
|
||||||
super(id, opts);
|
super(id, opts);
|
||||||
this.flood = new dht_flood_1.default({ id, swarm, ...opts });
|
this.flood = new dht_flood_1.default({ id, swarm, protocol, ...opts });
|
||||||
this.swarm = swarm;
|
this.swarm = swarm;
|
||||||
this.flood.on("peer-open", (peer) => this.handlePeerAdd(peer));
|
this.flood.on("peer-open", (peer) => this.handlePeerAdd(peer));
|
||||||
this.flood.on("peer-remove", (peer) => this.handlePeerRemove(peer));
|
this.flood.on("peer-remove", (peer) => this.handlePeerRemove(peer));
|
||||||
|
|
|
@ -9,10 +9,15 @@ export default class DHTOnline extends DHTOnlineBase {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
swarm: any,
|
swarm: any,
|
||||||
{ id = swarm.keyPair.publicKey, data = {}, ...opts } = {}
|
{
|
||||||
|
id = swarm.keyPair.publicKey,
|
||||||
|
data = {},
|
||||||
|
protocol = undefined,
|
||||||
|
...opts
|
||||||
|
} = {}
|
||||||
) {
|
) {
|
||||||
super(id, opts);
|
super(id, opts);
|
||||||
this.flood = new DHTFlood({ id, swarm, ...opts });
|
this.flood = new DHTFlood({ id, swarm, protocol, ...opts });
|
||||||
this.swarm = swarm;
|
this.swarm = swarm;
|
||||||
|
|
||||||
this.flood.on("peer-open", (peer) => this.handlePeerAdd(peer));
|
this.flood.on("peer-open", (peer) => this.handlePeerAdd(peer));
|
||||||
|
|
Loading…
Reference in New Issue