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:
@@ -32,7 +32,7 @@ Progress.prototype.addLoading = function() {
|
||||
* Increment the count of loaded tiles.
|
||||
*/
|
||||
Progress.prototype.addLoaded = function() {
|
||||
var this_ = this;
|
||||
const this_ = this;
|
||||
setTimeout(function() {
|
||||
++this_.loaded;
|
||||
this_.update();
|
||||
@@ -44,12 +44,12 @@ Progress.prototype.addLoaded = function() {
|
||||
* Update the progress bar.
|
||||
*/
|
||||
Progress.prototype.update = function() {
|
||||
var width = (this.loaded / this.loading * 100).toFixed(1) + '%';
|
||||
const width = (this.loaded / this.loading * 100).toFixed(1) + '%';
|
||||
this.el.style.width = width;
|
||||
if (this.loading === this.loaded) {
|
||||
this.loading = 0;
|
||||
this.loaded = 0;
|
||||
var this_ = this;
|
||||
const this_ = this;
|
||||
setTimeout(function() {
|
||||
this_.hide();
|
||||
}, 500);
|
||||
@@ -75,9 +75,9 @@ Progress.prototype.hide = function() {
|
||||
}
|
||||
};
|
||||
|
||||
var progress = new Progress(document.getElementById('progress'));
|
||||
const progress = new Progress(document.getElementById('progress'));
|
||||
|
||||
var source = new TileJSON({
|
||||
const source = new TileJSON({
|
||||
url: 'https://api.tiles.mapbox.com/v3/mapbox.world-bright.json?secure',
|
||||
crossOrigin: 'anonymous'
|
||||
});
|
||||
@@ -93,7 +93,7 @@ source.on('tileloaderror', function() {
|
||||
progress.addLoaded();
|
||||
});
|
||||
|
||||
var map = new Map({
|
||||
const map = new Map({
|
||||
layers: [
|
||||
new TileLayer({source: source})
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user