Skip to content

Commit 21af830

Browse files
committed
Replace a few var usages with const
1 parent ecebbb7 commit 21af830

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/cropt.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class TransformOrigin {
3434
this.y = 0;
3535
return;
3636
}
37-
var css = el.style.transformOrigin.split(" ");
38-
this.x = parseFloat(css[0]);
39-
this.y = parseFloat(css[1]);
37+
const [x, y] = el.style.transformOrigin.split(" ");
38+
this.x = parseFloat(x);
39+
this.y = parseFloat(y);
4040
}
4141

4242
toString() {
@@ -60,7 +60,7 @@ function setZoomerVal(value: number, zoomer: HTMLInputElement) {
6060
}
6161

6262
function loadImage(src: string): Promise<HTMLImageElement> {
63-
var img = new Image();
63+
const img = new Image();
6464

6565
return new Promise(function (resolve, reject) {
6666
img.onload = () => {
@@ -300,7 +300,7 @@ export class Cropt {
300300

301301
setZoom(value: number) {
302302
setZoomerVal(value, this.elements.zoomer);
303-
var event = new Event("input");
303+
const event = new Event("input");
304304
this.elements.zoomer.dispatchEvent(event); // triggers this.#onZoom call
305305
}
306306

0 commit comments

Comments
 (0)