Compare commits

..

3 Commits

Author SHA1 Message Date
Derrick Hammer 422c11b9b8
*update dist 2023-04-15 19:35:19 -04:00
Derrick Hammer b2b041c3a1
*override callbacks 2023-04-15 19:34:45 -04:00
Derrick Hammer d63fa22d00
*make protected 2023-04-15 19:34:24 -04:00
4 changed files with 12 additions and 6 deletions

View File

@ -64,6 +64,9 @@ class MultiSocketProxy extends proxy_js_1.default {
createDefaultMessage: false,
...options,
});
this._socketOptions.onchannel = this.handleNewPeerChannel.bind(this);
this._socketOptions.onclose = this.handleClosePeer.bind(this);
this._socketOptions.onopen = this.handlePeer.bind(this);
if (options.socketClass) {
this.socketClass = options.socketClass;
}

6
dist/proxy.d.ts vendored
View File

@ -6,9 +6,9 @@ export interface ProxyOptions extends DataSocketOptions {
autostart?: boolean;
}
export default abstract class Proxy {
private _listen;
private _socketOptions;
private _autostart;
protected _listen: any;
protected _socketOptions: DataSocketOptions;
protected _autostart: boolean;
constructor({ swarm, protocol, onopen, onreceive, onsend, onclose, onchannel, listen, autostart, emulateWebsocket, createDefaultMessage, }: ProxyOptions);
private _swarm;
get swarm(): any;

View File

@ -80,6 +80,9 @@ export default class MultiSocketProxy extends Proxy {
createDefaultMessage: false,
...options,
});
this._socketOptions.onchannel = this.handleNewPeerChannel.bind(this);
this._socketOptions.onclose = this.handleClosePeer.bind(this);
this._socketOptions.onopen = this.handlePeer.bind(this);
if (options.socketClass) {
this.socketClass = options.socketClass;
} else {

View File

@ -9,9 +9,9 @@ export interface ProxyOptions extends DataSocketOptions {
}
export default abstract class Proxy {
private _listen: any;
private _socketOptions: DataSocketOptions;
private _autostart: boolean;
protected _listen: any;
protected _socketOptions: DataSocketOptions;
protected _autostart: boolean;
constructor({
swarm,