Update stream.ts
This commit is contained in:
parent
f44c2a3e4f
commit
2dea88a147
1 changed files with 4 additions and 2 deletions
|
@ -29,7 +29,8 @@ export default class Stream extends EventEmitter {
|
||||||
this.stream.addEventListener('message', this.onMessage);
|
this.stream.addEventListener('message', this.onMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public useSharedConnection = (channel: string): SharedConnection => {
|
@autobind
|
||||||
|
public useSharedConnection(channel: string): SharedConnection {
|
||||||
let pool = this.sharedConnectionPools.find(p => p.channel === channel);
|
let pool = this.sharedConnectionPools.find(p => p.channel === channel);
|
||||||
|
|
||||||
if (pool == null) {
|
if (pool == null) {
|
||||||
|
@ -47,7 +48,8 @@ export default class Stream extends EventEmitter {
|
||||||
this.sharedConnections = this.sharedConnections.filter(c => c !== connection);
|
this.sharedConnections = this.sharedConnections.filter(c => c !== connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public connectToChannel = (channel: string, params?: any): NonSharedConnection => {
|
@autobind
|
||||||
|
public connectToChannel(channel: string, params?: any): NonSharedConnection {
|
||||||
const connection = new NonSharedConnection(this, channel, params);
|
const connection = new NonSharedConnection(this, channel, params);
|
||||||
this.nonSharedConnections.push(connection);
|
this.nonSharedConnections.push(connection);
|
||||||
return connection;
|
return connection;
|
||||||
|
|
Loading…
Reference in a new issue