summaryrefslogtreecommitdiffstats
path: root/src/mixins
diff options
context:
space:
mode:
authorEng Zer Jun <engzerjun@gmail.com>2023-05-04 17:59:36 +0800
committerEng Zer Jun <engzerjun@gmail.com>2023-05-04 17:59:36 +0800
commit534fe031ff1dc2f7a0b4bf835233b625ca498a64 (patch)
tree363c8a6a843f25ae1fc6a4b8fd0b2541beb0fd42 /src/mixins
parent217a59c81564d75146229be2ad749cf19d19d1db (diff)
refactor: replace `indexOf` with `includes`
This commit replaces the use of `.indexOf` with `.includes` for cases where the method is used to check if an array contains a particular element. This results in improved code readability and better adherence to modern JavaScript best practices. The replaced code snippets include: - `.indexOf(...) === -1` - `.indexOf(...) > -1` - `.indexOf(...) >= 0` Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Diffstat (limited to 'src/mixins')
-rw-r--r--src/mixins/devices.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mixins/devices.js b/src/mixins/devices.js
index 519728233..abeda5505 100644
--- a/src/mixins/devices.js
+++ b/src/mixins/devices.js
@@ -386,7 +386,7 @@ export const devices = {
// insecure contexts; in older browser versions it is, but getting
// the user media fails with "NotAllowedError".
const isInsecureContext = 'isSecureContext' in window && !window.isSecureContext
- const isInsecureContextAccordingToErrorMessage = this.audioStreamError.message && this.audioStreamError.message.indexOf('Only secure origins') !== -1
+ const isInsecureContextAccordingToErrorMessage = this.audioStreamError.message && this.audioStreamError.message.includes('Only secure origins')
if ((this.audioStreamError.name === 'NotSupportedError' && isInsecureContext)
|| (this.audioStreamError.name === 'NotAllowedError' && isInsecureContextAccordingToErrorMessage)) {
return t('spreed', 'Access to microphone is only possible with HTTPS')
@@ -412,7 +412,7 @@ export const devices = {
// insecure contexts; in older browser versions it is, but getting
// the user media fails with "NotAllowedError".
const isInsecureContext = 'isSecureContext' in window && !window.isSecureContext
- const isInsecureContextAccordingToErrorMessage = this.videoStreamError.message && this.videoStreamError.message.indexOf('Only secure origins') !== -1
+ const isInsecureContextAccordingToErrorMessage = this.videoStreamError.message && this.videoStreamError.message.includes('Only secure origins')
if ((this.videoStreamError.name === 'NotSupportedError' && isInsecureContext)
|| (this.videoStreamError.name === 'NotAllowedError' && isInsecureContextAccordingToErrorMessage)) {
return t('spreed', 'Access to camera is only possible with HTTPS')