Use const instead of let when possible

This commit is contained in:
miruka
2020-03-08 04:46:20 -04:00
parent ffc8a13db6
commit cdb79d11aa
23 changed files with 57 additions and 57 deletions

View File

@@ -71,8 +71,8 @@ HMxcImage {
return
}
let toOpen = loader.mediaUrl || loader.thumbnailMxc
let isMxc = toOpen.startsWith("mxc://")
const toOpen = loader.mediaUrl || loader.thumbnailMxc
const isMxc = toOpen.startsWith("mxc://")
isMxc ?
py.callClientCoro(chat.userId, "mxc_to_http", [toOpen], callback) :

View File

@@ -20,11 +20,11 @@ Rectangle {
target: null
onActiveChanged: if (! active) dragFlicker.speed = 0
onCentroidChanged: {
let left = centroid.pressedButtons & Qt.LeftButton
let vel = centroid.velocity.y
let pos = centroid.position.y
let dist = Math.min(selectableLabelContainer.height / 4, 50)
let boost = 20 * (pos < dist ? -pos : -(height - pos))
const left = centroid.pressedButtons & Qt.LeftButton
const vel = centroid.velocity.y
const pos = centroid.position.y
const dist = Math.min(selectableLabelContainer.height / 4, 50)
const boost = 20 * (pos < dist ? -pos : -(height - pos))
dragFlicker.speed =
left && vel && pos < dist ? 1000 + boost :

View File

@@ -47,19 +47,19 @@ HLoader {
if (singleMediaInfo.event_type === "RoomAvatarEvent")
return EventDelegate.Media.Image
let mainType = singleMediaInfo.media_mime.split("/")[0].toLowerCase()
const mainType = singleMediaInfo.media_mime.split("/")[0].toLowerCase()
if (mainType === "image") return EventDelegate.Media.Image
if (mainType === "video") return EventDelegate.Media.Video
if (mainType === "audio") return EventDelegate.Media.Audio
let fileEvents = ["RoomMessageFile", "RoomEncryptedFile"]
const fileEvents = ["RoomMessageFile", "RoomEncryptedFile"]
if (fileEvents.includes(singleMediaInfo.event_type))
return EventDelegate.Media.File
// If this is a preview for a link in a normal message
let ext = utils.urlExtension(mediaUrl)
const ext = utils.urlExtension(mediaUrl)
if (imageExtensions.includes(ext)) return EventDelegate.Media.Image
if (videoExtensions.includes(ext)) return EventDelegate.Media.Video