hyperswarm-web/dist/index.d.ts

42 lines
1.8 KiB
TypeScript
Raw Normal View History

2022-07-20 05:59:16 +00:00
import DhtNode from "@hyperswarm/dht-relay";
2023-01-31 10:10:34 +00:00
import Hyperswarm from "hyperswarm";
2023-02-18 03:23:06 +00:00
import EventEmitter, { OnOptions } from "eventemitter2";
2023-01-31 10:10:34 +00:00
export default class HyperswarmWeb extends EventEmitter {
2022-07-20 05:59:16 +00:00
private _options;
2023-01-31 10:10:34 +00:00
private _discovery;
2023-01-31 11:58:39 +00:00
private _queuedEmActions;
2023-02-01 13:15:36 +00:00
private _connectionMutex;
2023-01-31 10:10:34 +00:00
constructor(opts?: any);
2023-02-17 13:04:33 +00:00
private _relays;
get relays(): string[];
private _activeRelay;
2023-02-01 13:36:58 +00:00
get activeRelay(): Hyperswarm;
2023-02-17 13:04:33 +00:00
private _ready;
get ready(): boolean;
2023-02-01 13:22:47 +00:00
init(): Promise<void>;
2023-01-31 10:10:34 +00:00
connect(pubkey: string, options?: {}): Promise<DhtNode>;
addRelay(pubkey: string): Promise<void>;
2022-06-27 22:22:53 +00:00
removeRelay(pubkey: string): boolean;
clearRelays(): void;
2023-01-31 10:10:34 +00:00
on(eventName: string | symbol, listener: (...args: any[]) => void): Hyperswarm;
2023-02-18 03:23:06 +00:00
onSelf(eventName: string | symbol, listener: (...args: any[]) => void, options?: boolean | OnOptions): Hyperswarm;
2023-01-31 10:10:34 +00:00
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
off(eventName: string | symbol, listener: (...args: any[]) => void): Hyperswarm;
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
emit(eventName: string | symbol, ...args: any[]): boolean;
2023-02-18 03:23:06 +00:00
emitSelf(eventName: string | symbol, ...args: any[]): boolean;
2023-01-31 10:10:34 +00:00
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
2023-02-05 19:03:09 +00:00
join(topic: Uint8Array, opts?: {}): void;
joinPeer(publicKey: Uint8Array): void;
leave(topic: Uint8Array): void;
leavePeer(publicKey: Uint8Array): void;
2023-02-01 18:45:36 +00:00
status(publicKey: Uint8Array): any;
topics(): string[];
flush(): Promise<any>;
clear(): Promise<any>;
2023-02-17 13:04:33 +00:00
private ensureConnection;
private isServerAvailable;
private _processOrQueueAction;
private _processQueuedActions;
2022-06-27 22:22:53 +00:00
}
//# sourceMappingURL=index.d.ts.map