@@ -198,16 +198,6 @@ import Recorder from '../../../utils/recorder'
198198
199199const { detectMobile } = require (' ../../../utils/mobile-detection' )
200200
201- const debounce = (func , delay ) => {
202- let inDebounce
203- return function () {
204- const context = this
205- const args = arguments
206- clearTimeout (inDebounce)
207- inDebounce = setTimeout (() => func .apply (context, args), delay)
208- }
209- }
210-
211201export default {
212202 name: ' RoomFooter' ,
213203
@@ -336,28 +326,24 @@ export default {
336326 mounted () {
337327 const isMobile = detectMobile ()
338328
339- this .getTextareaRef ().addEventListener (
340- ' keyup' ,
341- debounce (e => {
342- if (e .key === ' Enter' && ! e .shiftKey && ! this .fileDialog ) {
343- if (isMobile) {
344- this .message = this .message + ' \n '
345- setTimeout (() => this .onChangeInput ())
346- } else if (
347- ! this .filteredEmojis .length &&
348- ! this .filteredUsersTag .length &&
349- ! this .filteredTemplatesText .length
350- ) {
351- this .sendMessage ()
352- }
329+ this .getTextareaRef ().addEventListener (' keyup' , e => {
330+ if (e .key === ' Enter' && ! e .shiftKey && ! this .fileDialog ) {
331+ if (isMobile) {
332+ this .message = this .message + ' \n '
333+ setTimeout (() => this .onChangeInput ())
334+ } else if (
335+ ! this .filteredEmojis .length &&
336+ ! this .filteredUsersTag .length &&
337+ ! this .filteredTemplatesText .length
338+ ) {
339+ this .sendMessage ()
353340 }
341+ }
354342
355- setTimeout (() => {
356- this .updateFooterLists ()
357- }, 60 )
358- }),
359- 50
360- )
343+ setTimeout (() => {
344+ this .updateFooterLists ()
345+ }, 60 )
346+ })
361347
362348 this .getTextareaRef ().addEventListener (' click' , () => {
363349 if (isMobile) this .keepKeyboardOpen = true
@@ -393,14 +379,14 @@ export default {
393379 })
394380 }
395381 },
396- onChangeInput: debounce ( function () {
382+ onChangeInput () {
397383 if (this .getTextareaRef ()? .value || this .getTextareaRef ()? .value === ' ' ) {
398384 this .message = this .getTextareaRef ()? .value
399385 }
400386 this .keepKeyboardOpen = true
401387 this .resizeTextarea ()
402388 this .$emit (' typing-message' , this .message )
403- }, 100 ),
389+ },
404390 resizeTextarea () {
405391 const el = this .getTextareaRef ()
406392
0 commit comments