*Update dist

This commit is contained in:
Derrick Hammer 2023-03-02 05:37:30 -05:00
parent ae2ee61bec
commit baf0ac31e6
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 15 additions and 6 deletions

13
dist/peer.d.ts vendored
View File

@ -1,14 +1,23 @@
import Proxy from "./proxy.js";
import Socket from "./socket.js";
export type OnOpen = (socket: Socket, data: any) => {
export type OnOpen = (peer: Peer, socket: Socket, data: any) => {
connect: boolean;
} | Promise<{
connect: boolean;
}> | Promise<void> | void;
export type OnData = (data: any) => void;
export type OnData = (peer: Peer, data: any) => void;
export type OnReceive = OnData;
export type OnClose = OnData;
export type OnSend = OnData;
export type OnOpenBound = (socket: Socket, data: any) => {
connect: boolean;
} | Promise<{
connect: boolean;
}> | Promise<void> | void;
export type OnDataBound = (data: any) => void;
export type OnReceiveBound = OnDataBound;
export type OnCloseBound = OnDataBound;
export type OnSendBound = OnDataBound;
export interface DataSocketOptions {
onopen?: OnOpen;
onreceive?: OnReceive;

8
dist/peer.js vendored
View File

@ -20,10 +20,10 @@ class Peer {
this._proxy = proxy;
this._peer = peer;
this._muxer = muxer;
this._onopen = onopen?.bind(this);
this._onreceive = onreceive?.bind(this);
this._onsend = onsend?.bind(this);
this._onclose = onclose?.bind(this);
this._onopen = onopen?.bind(undefined, this);
this._onreceive = onreceive?.bind(undefined, this);
this._onsend = onsend?.bind(undefined, this);
this._onclose = onclose?.bind(undefined, this);
this._emulateWebsocket = emulateWebsocket;
}
async init() {