*Update dist
This commit is contained in:
parent
42f0c1b60d
commit
e48440710e
|
@ -1,6 +1,6 @@
|
||||||
import DhtNode from "@hyperswarm/dht-relay";
|
import DhtNode from "@hyperswarm/dht-relay";
|
||||||
import Hyperswarm from "hyperswarm";
|
import Hyperswarm from "hyperswarm";
|
||||||
import EventEmitter from "eventemitter2";
|
import EventEmitter, { OnOptions } from "eventemitter2";
|
||||||
export default class HyperswarmWeb extends EventEmitter {
|
export default class HyperswarmWeb extends EventEmitter {
|
||||||
private _options;
|
private _options;
|
||||||
private _discovery;
|
private _discovery;
|
||||||
|
@ -19,10 +19,12 @@ export default class HyperswarmWeb extends EventEmitter {
|
||||||
removeRelay(pubkey: string): boolean;
|
removeRelay(pubkey: string): boolean;
|
||||||
clearRelays(): void;
|
clearRelays(): void;
|
||||||
on(eventName: string | symbol, listener: (...args: any[]) => void): Hyperswarm;
|
on(eventName: string | symbol, listener: (...args: any[]) => void): Hyperswarm;
|
||||||
|
onSelf(eventName: string | symbol, listener: (...args: any[]) => void, options?: boolean | OnOptions): Hyperswarm;
|
||||||
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
off(eventName: string | symbol, listener: (...args: any[]) => void): Hyperswarm;
|
off(eventName: string | symbol, listener: (...args: any[]) => void): Hyperswarm;
|
||||||
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
emit(eventName: string | symbol, ...args: any[]): boolean;
|
emit(eventName: string | symbol, ...args: any[]): boolean;
|
||||||
|
emitSelf(eventName: string | symbol, ...args: any[]): boolean;
|
||||||
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
||||||
join(topic: Uint8Array, opts?: {}): void;
|
join(topic: Uint8Array, opts?: {}): void;
|
||||||
joinPeer(publicKey: Uint8Array): void;
|
joinPeer(publicKey: U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SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO;IAIzD,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO;IAI7D,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI;IAInE,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,KAAK,GAAG,IAAI;IAIxC,QAAQ,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;IAIrC,KAAK,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAI9B,SAAS,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI;IAItC,MAAM,CAAC,SAAS,EAAE,UAAU;IAI5B,MAAM,IAAI,MAAM,EAAE;IAIZ,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;IAIrB,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC;YAIpB,gBAAgB;YAuEhB,iBAAiB;IAa/B,OAAO,CAAC,qBAAqB;IAS7B,OAAO,CAAC,qBAAqB;CAO9B"}
|
|
@ -57,6 +57,9 @@ export default class HyperswarmWeb extends EventEmitter {
|
||||||
on(eventName, listener) {
|
on(eventName, listener) {
|
||||||
return this._processOrQueueAction("on", ...arguments);
|
return this._processOrQueueAction("on", ...arguments);
|
||||||
}
|
}
|
||||||
|
onSelf(eventName, listener, options) {
|
||||||
|
return super.on(eventName, listener, options);
|
||||||
|
}
|
||||||
addListener(eventName, listener) {
|
addListener(eventName, listener) {
|
||||||
return this.on(eventName, listener);
|
return this.on(eventName, listener);
|
||||||
}
|
}
|
||||||
|
@ -69,6 +72,9 @@ export default class HyperswarmWeb extends EventEmitter {
|
||||||
emit(eventName, ...args) {
|
emit(eventName, ...args) {
|
||||||
return this._processOrQueueAction("emit", ...arguments);
|
return this._processOrQueueAction("emit", ...arguments);
|
||||||
}
|
}
|
||||||
|
emitSelf(eventName, ...args) {
|
||||||
|
return super.emit(eventName, ...args);
|
||||||
|
}
|
||||||
once(eventName, listener) {
|
once(eventName, listener) {
|
||||||
return this._processOrQueueAction("once", ...arguments);
|
return this._processOrQueueAction("once", ...arguments);
|
||||||
}
|
}
|
||||||
|
@ -141,6 +147,7 @@ export default class HyperswarmWeb extends EventEmitter {
|
||||||
this._connectionMutex.release();
|
this._connectionMutex.release();
|
||||||
throw new Error("Failed to find an available relay");
|
throw new Error("Failed to find an available relay");
|
||||||
}
|
}
|
||||||
|
this.emitSelf("init");
|
||||||
this._processQueuedActions();
|
this._processQueuedActions();
|
||||||
await this._activeRelay.dht.ready();
|
await this._activeRelay.dht.ready();
|
||||||
this._connectionMutex.release();
|
this._connectionMutex.release();
|
||||||
|
|
Loading…
Reference in New Issue