@@ -198,16 +198,6 @@ import Recorder from '../../../utils/recorder'
198
198
199
199
const { detectMobile } = require (' ../../../utils/mobile-detection' )
200
200
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
-
211
201
export default {
212
202
name: ' RoomFooter' ,
213
203
@@ -336,28 +326,24 @@ export default {
336
326
mounted () {
337
327
const isMobile = detectMobile ()
338
328
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 ()
353
340
}
341
+ }
354
342
355
- setTimeout (() => {
356
- this .updateFooterLists ()
357
- }, 60 )
358
- }),
359
- 50
360
- )
343
+ setTimeout (() => {
344
+ this .updateFooterLists ()
345
+ }, 60 )
346
+ })
361
347
362
348
this .getTextareaRef ().addEventListener (' click' , () => {
363
349
if (isMobile) this .keepKeyboardOpen = true
@@ -393,14 +379,14 @@ export default {
393
379
})
394
380
}
395
381
},
396
- onChangeInput: debounce ( function () {
382
+ onChangeInput () {
397
383
if (this .getTextareaRef ()? .value || this .getTextareaRef ()? .value === ' ' ) {
398
384
this .message = this .getTextareaRef ()? .value
399
385
}
400
386
this .keepKeyboardOpen = true
401
387
this .resizeTextarea ()
402
388
this .$emit (' typing-message' , this .message )
403
- }, 100 ),
389
+ },
404
390
resizeTextarea () {
405
391
const el = this .getTextareaRef ()
406
392
0 commit comments