Use blocked scoped variables

In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
This commit is contained in:
Tim Schaub
2018-01-11 23:32:36 -07:00
parent 0bf2b04dee
commit ad62739a6e
684 changed files with 18120 additions and 18184 deletions
+6 -6
View File
@@ -7,7 +7,7 @@ import {asString} from '../color.js';
* Singleton class. Available through {@link ol.style.iconImageCache}.
* @constructor
*/
var IconImageCache = function() {
const IconImageCache = function() {
/**
* @type {Object.<string, ol.style.IconImage>}
@@ -36,7 +36,7 @@ var IconImageCache = function() {
* @return {string} Cache key.
*/
function getKey(src, crossOrigin, color) {
var colorString = color ? asString(color) : 'null';
const colorString = color ? asString(color) : 'null';
return crossOrigin + ':' + src + ':' + colorString;
}
@@ -55,8 +55,8 @@ IconImageCache.prototype.clear = function() {
*/
IconImageCache.prototype.expire = function() {
if (this.cacheSize_ > this.maxCacheSize_) {
var i = 0;
var key, iconImage;
let i = 0;
let key, iconImage;
for (key in this.cache_) {
iconImage = this.cache_[key];
if ((i++ & 3) === 0 && !iconImage.hasListener()) {
@@ -75,7 +75,7 @@ IconImageCache.prototype.expire = function() {
* @return {ol.style.IconImage} Icon image.
*/
IconImageCache.prototype.get = function(src, crossOrigin, color) {
var key = getKey(src, crossOrigin, color);
const key = getKey(src, crossOrigin, color);
return key in this.cache_ ? this.cache_[key] : null;
};
@@ -87,7 +87,7 @@ IconImageCache.prototype.get = function(src, crossOrigin, color) {
* @param {ol.style.IconImage} iconImage Icon image.
*/
IconImageCache.prototype.set = function(src, crossOrigin, color, iconImage) {
var key = getKey(src, crossOrigin, color);
const key = getKey(src, crossOrigin, color);
this.cache_[key] = iconImage;
++this.cacheSize_;
};