mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
reconnecter get and set for config.
This commit is contained in:
parent
121f3bbe29
commit
a38ad13fb1
@ -104,6 +104,18 @@ export class Reconnecter extends EventEmitter<ReconnecterEvents> {
|
||||
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 {
|
||||
if (this._open) {
|
||||
throw new Error('connection is already open')
|
||||
|
Loading…
Reference in New Issue
Block a user