Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Commit 0801fc3

Browse files
committed
chore: add interface constructors
1 parent 8fdc05d commit 0801fc3

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/stream-muxer/types.ts

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* A libp2p stream muxer
33
*/
44
export interface Muxer {
5+
new (options: MuxerOptions): Muxer; // eslint-disable-line
56
multicodec: string;
67
readonly streams: Array<MuxedStream>;
78
/**
@@ -21,6 +22,12 @@ export interface Muxer {
2122
onStreamEnd (stream: MuxedStream): void;
2223
}
2324

25+
export type MuxerOptions = {
26+
onStream: (stream: MuxedStream) => void;
27+
onStreamEnd: (stream: MuxedStream) => void;
28+
maxMsgSize?: number;
29+
}
30+
2431
export type MuxedTimeline = {
2532
open: number;
2633
close?: number;

src/transport/types.ts

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

0 commit comments

Comments
 (0)