mirror of
https://github.com/m1k1o/neko.git
synced 2025-06-15 17:22:44 +02:00
reconnecter get and set for config.
This commit is contained in:
parent
121f3bbe29
commit
a38ad13fb1
1 changed files with 12 additions and 0 deletions
|
@ -104,6 +104,18 @@ export class Reconnecter extends EventEmitter<ReconnecterEvents> {
|
||||||
return this._last_connected
|
return this._last_connected
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get config(): ReconnecterConfig {
|
||||||
|
return { ...this._config }
|
||||||
|
}
|
||||||
|
|
||||||
|
public set config(conf: ReconnecterConfig) {
|
||||||
|
this._config = { ...conf }
|
||||||
|
|
||||||
|
if (this._config.max_reconnects > this._total_reconnects) {
|
||||||
|
this.close(new Error('reconnection config changed'))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public open(): void {
|
public open(): void {
|
||||||
if (this._open) {
|
if (this._open) {
|
||||||
throw new Error('connection is already open')
|
throw new Error('connection is already open')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue