undefined typeof

This commit is contained in:
Henry Jameson 2026-08-04 00:31:24 +03:00
commit 0eb63de209
13 changed files with 25 additions and 25 deletions

View file

@ -59,7 +59,7 @@ const Chat = {
},
mounted() {
window.addEventListener('scroll', this.handleScroll)
if (typeof document.hidden !== 'undefined') {
if (document.hidden !== undefined) {
document.addEventListener(
'visibilitychange',
this.handleVisibilityChange,
@ -74,7 +74,7 @@ const Chat = {
unmounted() {
window.removeEventListener('scroll', this.handleScroll)
window.removeEventListener('resize', this.handleResize)
if (typeof document.hidden !== 'undefined')
if (document.hidden !== undefined)
document.removeEventListener(
'visibilitychange',
this.handleVisibilityChange,

View file

@ -134,7 +134,7 @@ export default {
emits: ['update:modelValue'],
computed: {
present() {
return typeof this.modelValue !== 'undefined'
return this.modelValue !== undefined
},
validColor() {
return hex2rgb(this.modelValue || this.fallback)

View file

@ -42,7 +42,7 @@ export default {
emits: ['update:modelValue'],
computed: {
present() {
return typeof this.modelValue !== 'undefined'
return this.modelValue !== undefined
},
},
}

View file

@ -68,7 +68,7 @@ export default {
emits: ['update:modelValue'],
computed: {
present() {
return typeof this.modelValue !== 'undefined'
return this.modelValue !== undefined
},
},
}

View file

@ -42,7 +42,7 @@ export default {
emits: ['update:modelValue'],
computed: {
present() {
return typeof this.modelValue !== 'undefined'
return this.modelValue !== undefined
},
},
}

View file

@ -159,7 +159,7 @@ export default {
return this.source || this.defaultSource
},
realDraftMode() {
return typeof this.draftMode === 'undefined'
return this.draftMode === undefined
? this.defaultDraftMode
: this.draftMode
},

View file

@ -147,7 +147,7 @@ export default {
})
},
mounted() {
if (typeof this.shadowSelected === 'undefined') {
if (this.shadowSelected === undefined) {
this.shadowSelected = this.shadowsAvailable[0]
}
},
@ -634,15 +634,15 @@ export default {
if (input.version) version = input.version
// Old v1 naming: fg is text, btn is foreground
if (
typeof colors.text === 'undefined' &&
typeof colors.fg !== 'undefined'
colors.text === undefined &&
colors.fg !== undefined
) {
version = 1
}
// New v2 naming: text is text, fg is foreground
if (
typeof colors.text !== 'undefined' &&
typeof colors.fg !== 'undefined'
colors.text !== undefined &&
colors.fg !== undefined
) {
version = 2
}
@ -679,7 +679,7 @@ export default {
if (opacity && !this.keepOpacity) {
this.clearOpacity()
Object.entries(opacity).forEach(([k, v]) => {
if (typeof v === 'undefined' || v === null || Number.isNaN(v)) return
if (v === undefined || v === null || Number.isNaN(v)) return
this[k + 'OpacityLocal'] = v
})
}

View file

@ -154,7 +154,7 @@ const Timeline = {
})
},
mounted() {
if (typeof document.hidden !== 'undefined') {
if (document.hidden !== undefined) {
document.addEventListener(
'visibilitychange',
this.handleVisibilityChange,
@ -168,7 +168,7 @@ const Timeline = {
unmounted() {
window.removeEventListener('scroll', this.handleScroll)
window.removeEventListener('keydown', this.handleShortKey)
if (typeof document.hidden !== 'undefined')
if (document.hidden !== undefined)
document.removeEventListener(
'visibilitychange',
this.handleVisibilityChange,

View file

@ -34,15 +34,15 @@ const VideoAttachment = {
// If hasAudio is false, we've already marked this video to not have audio,
// a video can't gain audio out of nowhere so don't bother checking again.
if (!this.hasAudio) return
if (typeof target.webkitAudioDecodedByteCount !== 'undefined') {
if (target.webkitAudioDecodedByteCount !== undefined) {
// non-zero if video has audio track
if (target.webkitAudioDecodedByteCount > 0) return
}
if (typeof target.mozHasAudio !== 'undefined') {
if (target.mozHasAudio !== undefined) {
// true if video has audio track
if (target.mozHasAudio) return
}
if (typeof target.audioTracks !== 'undefined') {
if (target.audioTracks !== undefined) {
if (target.audioTracks.length > 0) return
}
this.hasAudio = false