mirror of
https://github.com/m1k1o/neko.git
synced 2025-06-13 16:23:52 +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
|
||||
}
|
||||
|
||||
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…
Add table
Add a link
Reference in a new issue