chore: add interface constructors

This commit is contained in:
Vasco Santos 2020-12-02 16:30:59 +01:00
parent 8fdc05d37d
commit 0801fc3c0b
2 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,7 @@
* A libp2p stream muxer
*/
export interface Muxer {
new (options: MuxerOptions): Muxer; // eslint-disable-line
multicodec: string;
readonly streams: Array<MuxedStream>;
/**
@ -21,6 +22,12 @@ export interface Muxer {
onStreamEnd (stream: MuxedStream): void;
}
export type MuxerOptions = {
onStream: (stream: MuxedStream) => void;
onStreamEnd: (stream: MuxedStream) => void;
maxMsgSize?: number;
}
export type MuxedTimeline = {
open: number;
close?: number;

View File

@ -6,6 +6,7 @@ import Connection from '../connection/connection'
* A libp2p transport is understood as something that offers a dial and listen interface to establish connections.
*/
export interface Transport {
new (upgrader: Upgrader, ...others: any): Transport; // eslint-disable-line
/**
* Dial a given multiaddr.
*/