Skip to content

Commit e19af60

Browse files
authored
abstract animation length to one global variable
1 parent 3bac7f5 commit e19af60

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

js/index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
let appJSON = []; // List of apps and info from apps.json
32
let appSortInfo = {}; // list of data to sort by, from appdates.csv { created, modified }
43
let appCounts = {};
@@ -42,6 +41,7 @@ let device = {
4241
}
4342
};*/
4443
let LANGUAGE = undefined;
44+
const favAnimMS = 500;
4545

4646
/** Ensure we run transfers one after the other rather that potentially having them overlap if the user clicks around
4747
https://github.com/espruino/EspruinoAppLoaderCore/issues/67 */
@@ -871,11 +871,10 @@ function refreshLibrary(options) {
871871
let txt = (cnt > 999) ? Math.round(cnt/100)/10+"k" : cnt;
872872
let countEl = button.querySelector('.fav-count');
873873
if (countEl) countEl.textContent = String(txt);
874-
const ANIM_MS = 500;
875874
// ensure animation class is removed after the duration so it can be re-triggered
876875
setTimeout(() => {
877876
try { if (icon) icon.classList.remove("favoriteAnim"); } catch (e) { console.error(e); }
878-
}, ANIM_MS);
877+
}, favAnimMS);
879878
}
880879
});
881880
});
@@ -1163,10 +1162,9 @@ function refreshMyApps() {
11631162
let txt = (cnt > 999) ? Math.round(cnt/100)/10+"k" : cnt;
11641163
let countEl = button.querySelector('.fav-count');
11651164
if (countEl) countEl.textContent = String(txt);
1166-
const ANIM_MS = 500;
11671165
setTimeout(() => {
11681166
try { if (icon) icon.classList.remove("favoriteAnim"); } catch (e) {}
1169-
}, ANIM_MS);
1167+
}, favAnimMS);
11701168
}
11711169
});
11721170
});

0 commit comments

Comments
 (0)