From 471b26ace5af317306e1d36aa6d807c8f87f2377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sun, 11 Jul 2021 22:38:48 +0200 Subject: [PATCH] add connection status event. --- src/component/internal/messages.ts | 1 + src/component/main.vue | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/component/internal/messages.ts b/src/component/internal/messages.ts index 3d24fab1..9a6e9056 100644 --- a/src/component/internal/messages.ts +++ b/src/component/internal/messages.ts @@ -9,6 +9,7 @@ import NekoState from '../types/state' export interface NekoEvents { // connection events + ['connection.status']: (status: 'connected' | 'connecting' | 'disconnected') => void ['connection.webrtc.sdp']: (type: 'local' | 'remote', data: string) => void ['connection.webrtc.sdp.candidate']: (type: 'local' | 'remote', data: RTCIceCandidateInit) => void ['connection.disconnect']: (message: string) => void diff --git a/src/component/main.vue b/src/component/main.vue index 404f2865..28c12898 100644 --- a/src/component/main.vue +++ b/src/component/main.vue @@ -455,6 +455,11 @@ } } + @Watch('state.connection.status') + onConnectionChange(status: 'connected' | 'connecting' | 'disconnected') { + this.events.emit('connection.status', status) + } + clear() { // destroy video if (this._video) {