Better variables scoping

This commit is contained in:
Frederic Junod
2018-01-17 09:05:39 +01:00
parent ee348c50e9
commit 4c5ca75ca6
21 changed files with 93 additions and 147 deletions

View File

@@ -56,9 +56,8 @@ IconImageCache.prototype.clear = function() {
IconImageCache.prototype.expire = function() {
if (this.cacheSize_ > this.maxCacheSize_) {
let i = 0;
let key, iconImage;
for (key in this.cache_) {
iconImage = this.cache_[key];
for (const key in this.cache_) {
const iconImage = this.cache_[key];
if ((i++ & 3) === 0 && !iconImage.hasListener()) {
delete this.cache_[key];
--this.cacheSize_;