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:
@@ -3,18 +3,18 @@ import View from '../src/ol/View.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import XYZ from '../src/ol/source/XYZ.js';
|
||||
|
||||
var url = 'https://{a-c}.tiles.mapbox.com/v3/mapbox.world-bright/{z}/{x}/{y}.png';
|
||||
const url = 'https://{a-c}.tiles.mapbox.com/v3/mapbox.world-bright/{z}/{x}/{y}.png';
|
||||
|
||||
var withTransition = new TileLayer({
|
||||
const withTransition = new TileLayer({
|
||||
source: new XYZ({url: url})
|
||||
});
|
||||
|
||||
var withoutTransition = new TileLayer({
|
||||
const withoutTransition = new TileLayer({
|
||||
source: new XYZ({url: url, transition: 0}),
|
||||
visible: false
|
||||
});
|
||||
|
||||
var map = new Map({
|
||||
const map = new Map({
|
||||
layers: [withTransition, withoutTransition],
|
||||
target: 'map',
|
||||
view: new View({
|
||||
@@ -25,7 +25,7 @@ var map = new Map({
|
||||
});
|
||||
|
||||
document.getElementById('transition').addEventListener('change', function(event) {
|
||||
var transition = event.target.checked;
|
||||
const transition = event.target.checked;
|
||||
withTransition.setVisible(transition);
|
||||
withoutTransition.setVisible(!transition);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user