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:
+7
-7
@@ -10,15 +10,15 @@ import TileJSON from '../src/ol/source/TileJSON.js';
|
||||
/**
|
||||
* Elements that make up the popup.
|
||||
*/
|
||||
var container = document.getElementById('popup');
|
||||
var content = document.getElementById('popup-content');
|
||||
var closer = document.getElementById('popup-closer');
|
||||
const container = document.getElementById('popup');
|
||||
const content = document.getElementById('popup-content');
|
||||
const closer = document.getElementById('popup-closer');
|
||||
|
||||
|
||||
/**
|
||||
* Create an overlay to anchor the popup to the map.
|
||||
*/
|
||||
var overlay = new Overlay({
|
||||
const overlay = new Overlay({
|
||||
element: container,
|
||||
autoPan: true,
|
||||
autoPanAnimation: {
|
||||
@@ -41,7 +41,7 @@ closer.onclick = function() {
|
||||
/**
|
||||
* Create the map.
|
||||
*/
|
||||
var map = new Map({
|
||||
const map = new Map({
|
||||
layers: [
|
||||
new TileLayer({
|
||||
source: new TileJSON({
|
||||
@@ -63,8 +63,8 @@ var map = new Map({
|
||||
* Add a click handler to the map to render the popup.
|
||||
*/
|
||||
map.on('singleclick', function(evt) {
|
||||
var coordinate = evt.coordinate;
|
||||
var hdms = _ol_coordinate_.toStringHDMS(toLonLat(coordinate));
|
||||
const coordinate = evt.coordinate;
|
||||
const hdms = _ol_coordinate_.toStringHDMS(toLonLat(coordinate));
|
||||
|
||||
content.innerHTML = '<p>You clicked here:</p><code>' + hdms +
|
||||
'</code>';
|
||||
|
||||
Reference in New Issue
Block a user