mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add disconnect event.
This commit is contained in:
@ -6,9 +6,7 @@ import { NekoWebRTC, WebRTCStats } from './webrtc'
|
||||
import { Connection } from '../types/state'
|
||||
|
||||
export interface NekoConnectionEvents {
|
||||
connecting: () => void
|
||||
connected: () => void
|
||||
disconnected: (error?: Error) => void
|
||||
disconnect: (error?: Error) => void
|
||||
}
|
||||
|
||||
export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
|
||||
@ -94,7 +92,9 @@ export class NekoConnection extends EventEmitter<NekoConnectionEvents> {
|
||||
}
|
||||
|
||||
public disconnect() {
|
||||
this.webrtc.disconnect()
|
||||
this.websocket.disconnect()
|
||||
Vue.set(this._state, 'status', 'disconnected')
|
||||
this.emit('disconnect')
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user