mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
emit close event after closing all reconnectors.
This commit is contained in:
parent
9a77f6adea
commit
ac6df17036
@ -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…
Reference in New Issue
Block a user