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
+7 -7
View File
@@ -4,7 +4,7 @@ import TileLayer from '../src/ol/layer/Tile.js';
import BingMaps from '../src/ol/source/BingMaps.js';
var styles = [
const styles = [
'Road',
'RoadOnDemand',
'Aerial',
@@ -12,8 +12,8 @@ var styles = [
'collinsBart',
'ordnanceSurvey'
];
var layers = [];
var i, ii;
const layers = [];
let i, ii;
for (i = 0, ii = styles.length; i < ii; ++i) {
layers.push(new TileLayer({
visible: false,
@@ -27,7 +27,7 @@ for (i = 0, ii = styles.length; i < ii; ++i) {
})
}));
}
var map = new Map({
const map = new Map({
layers: layers,
// Improve user experience by loading tiles while dragging/zooming. Will make
// zooming choppy on mobile or slow devices.
@@ -39,10 +39,10 @@ var map = new Map({
})
});
var select = document.getElementById('layer-select');
const select = document.getElementById('layer-select');
function onChange() {
var style = select.value;
for (var i = 0, ii = layers.length; i < ii; ++i) {
const style = select.value;
for (let i = 0, ii = layers.length; i < ii; ++i) {
layers[i].setVisible(styles[i] === style);
}
}