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

@@ -27,7 +27,7 @@ Rectangle {
function enterClickButton() {
for (let i = 0; i < buttonModel.length; i++) {
let btn = buttonRepeater.itemAt(i)
const btn = buttonRepeater.itemAt(i)
if (btn.enabled && btn.name === clickButtonOnEnter) btn.clicked()
}
}

View File

@@ -11,7 +11,7 @@ Menu {
let result = 0
for (let i = 0; i < count; ++i) {
let item = itemAt(i)
const item = itemAt(i)
if (! item.visible) continue
result = Math.max(item.implicitWidth, result)

View File

@@ -25,8 +25,8 @@ HImage {
function update() {
if (! py) return // component was destroyed
let w = sourceSize.width || width
let h = sourceSize.height || height
const w = sourceSize.width || width
const h = sourceSize.height || height
if (! image.mxc || w < 1 || h < 1 ) {
show = false
@@ -39,9 +39,9 @@ HImage {
return
}
let method = image.thumbnail ? "get_thumbnail" : "get_media"
let args = image.thumbnail ?
[image.mxc, w, h, cryptDict] : [image.mxc, cryptDict]
const method = image.thumbnail ? "get_thumbnail" : "get_media"
const args = image.thumbnail ?
[image.mxc, w, h, cryptDict] : [image.mxc, cryptDict]
py.callCoro("media_cache." + method, args, path => {
if (! image) return

View File

@@ -25,9 +25,9 @@ FocusScope {
]
readonly property string joinedSelection: {
let toCopy = []
const toCopy = []
for (let key of Object.keys(selectedTexts).sort()) {
for (const key of Object.keys(selectedTexts).sort()) {
if (! selectedTexts[key]) continue
// For some dumb reason, Object.keys convert the floats to strings
@@ -53,7 +53,7 @@ FocusScope {
selecting = false
}
onDragPointChanged: {
let pos = mapFromItem(
const pos = mapFromItem(
mainUI, eventPoint.scenePosition.x, eventPoint.scenePosition.y,
)
draggedItem.x = pos.x