diff options
author | Joas Schilling <coding@schilljs.com> | 2021-08-23 17:12:20 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-08-23 17:30:02 +0300 |
commit | f700cbc36bf8192843126af02bdf5ff38b639c42 (patch) | |
tree | af8c191cbf8753f0ca012859970240ebbb60b906 /src/utils/signaling.js | |
parent | a58d76c3ae7489cd4dec063d2bd36ca0eb69c3cc (diff) |
Fix event names to kebap-case
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src/utils/signaling.js')
-rw-r--r-- | src/utils/signaling.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/utils/signaling.js b/src/utils/signaling.js index d44b0722d..7eba45581 100644 --- a/src/utils/signaling.js +++ b/src/utils/signaling.js @@ -132,7 +132,12 @@ Signaling.Base.prototype._trigger = function(ev, args) { } } - EventBus.$emit('Signaling::' + ev, args) + // Convert webrtc event names to kebab-case for "vue/custom-event-name-casing" + const kebabCase = string => string + .replace(/([a-z])([A-Z])/g, '$1-$2') + .replace(/[\s_]+/g, '-') + .toLowerCase() + EventBus.$emit('signaling-' + kebabCase(ev), args) } Signaling.Base.prototype.isNoMcuWarningEnabled = function() { @@ -487,11 +492,11 @@ Signaling.Internal.prototype._startPullingMessages = function() { console.error('Session was killed but the conversation still exists') this._trigger('pullMessagesStoppedOnFail') - EventBus.$emit('duplicateSessionDetected') + EventBus.$emit('duplicate-session-detected') } else if (error?.response?.status === 404 || error?.response?.status === 403) { // Conversation was deleted or the user was removed console.error('Conversation was not found anymore') - EventBus.$emit('deletedSessionDetected') + EventBus.$emit('deleted-session-detected') } else if (token) { if (this.pullMessagesFails === 1) { this.pullMessageErrorToast = showError(t('spreed', 'Lost connection to signaling server. Trying to reconnect.'), { @@ -699,7 +704,7 @@ Signaling.Standalone.prototype.connect = function() { this.nextcloudSessionId = null } else { // TODO(fancycode): Only fetch properties of room that was modified. - EventBus.$emit('shouldRefreshConversations') + EventBus.$emit('should-refresh-conversations') } break case 'event': @@ -1180,7 +1185,7 @@ Signaling.Standalone.prototype.processRoomMessageEvent = function(data) { switch (data.type) { case 'chat': // FIXME this is not listened to - EventBus.$emit('shouldRefreshChatMessages') + EventBus.$emit('should-refresh-chat-messages') break default: console.error('Unknown room message event', data) @@ -1196,13 +1201,13 @@ Signaling.Standalone.prototype.processRoomListEvent = function(data) { return } console.error('User or session was removed from the conversation, redirecting') - EventBus.$emit('deletedSessionDetected') + EventBus.$emit('deleted-session-detected') break } // eslint-disable-next-line no-fallthrough default: console.debug('Room list event', data) - EventBus.$emit('shouldRefreshConversations') + EventBus.$emit('should-refresh-conversations') break } } |