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

Commit

Permalink
chore: add interface constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Dec 2, 2020
1 parent 8fdc05d commit 30fe22d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/stream-muxer/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* A libp2p stream muxer
*/
export interface Muxer {
new (options: MuxerOptions): Muxer;
multicodec: string;
readonly streams: Array<MuxedStream>;
/**
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/transport/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/**
* Dial a given multiaddr.
*/
Expand Down

0 comments on commit 30fe22d

Please sign in to comment.