mirror of
https://github.com/m1k1o/neko.git
synced 2025-06-13 08:12:57 +02:00
add disconnect event.
This commit is contained in:
parent
1dcce7d949
commit
daff2552a3
2 changed files with 12 additions and 10 deletions
|
@ -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')
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue