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,22 +3,22 @@ import View from '../src/ol/View.js';
|
||||
import TileLayer from '../src/ol/layer/Tile.js';
|
||||
import OSM from '../src/ol/source/OSM.js';
|
||||
|
||||
var viewport = document.getElementById('map');
|
||||
const viewport = document.getElementById('map');
|
||||
|
||||
function getMinZoom() {
|
||||
var width = viewport.clientWidth;
|
||||
const width = viewport.clientWidth;
|
||||
return Math.ceil(Math.LOG2E * Math.log(width / 256));
|
||||
}
|
||||
|
||||
var initialZoom = getMinZoom();
|
||||
const initialZoom = getMinZoom();
|
||||
|
||||
var view = new View({
|
||||
const view = new View({
|
||||
center: [0, 0],
|
||||
minZoom: initialZoom,
|
||||
zoom: initialZoom
|
||||
});
|
||||
|
||||
var map = new Map({
|
||||
const map = new Map({
|
||||
layers: [
|
||||
new TileLayer({
|
||||
source: new OSM()
|
||||
@@ -29,7 +29,7 @@ var map = new Map({
|
||||
});
|
||||
|
||||
window.addEventListener('resize', function() {
|
||||
var minZoom = getMinZoom();
|
||||
const minZoom = getMinZoom();
|
||||
if (minZoom !== view.getMinZoom()) {
|
||||
view.setMinZoom(minZoom);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user