mirror of
https://github.com/m1k1o/neko.git
synced 2025-08-06 10:20:26 +02:00
emit close event after closing all reconnectors.
This commit is contained in:
parent
9a77f6adea
commit
ac6df17036
1 changed files with 5 additions and 4 deletions
|
@ -201,18 +201,19 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
|
|||
|
||||
public close(error?: Error) {
|
||||
if (this._open) {
|
||||
this._open = false
|
||||
|
||||
// set state to disconnected
|
||||
Vue.set(this._state.websocket, 'connected', false)
|
||||
Vue.set(this._state.webrtc, 'connected', false)
|
||||
Vue.set(this._state, 'status', 'disconnected')
|
||||
|
||||
this.emit('close', error)
|
||||
}
|
||||
|
||||
// close all reconnectors
|
||||
Object.values(this._reconnector).forEach((r) => r.close())
|
||||
|
||||
if (this._open) {
|
||||
this._open = false
|
||||
this.emit('close', error)
|
||||
}
|
||||
}
|
||||
|
||||
public destroy() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue