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

View File

@@ -23,13 +23,13 @@ import Interaction from '../interaction/Interaction.js';
* @extends {ol.interaction.Interaction}
* @api
*/
var KeyboardZoom = function(opt_options) {
const KeyboardZoom = function(opt_options) {
Interaction.call(this, {
handleEvent: KeyboardZoom.handleEvent
});
var options = opt_options ? opt_options : {};
const options = opt_options ? opt_options : {};
/**
* @private
@@ -65,18 +65,18 @@ inherits(KeyboardZoom, Interaction);
* @api
*/
KeyboardZoom.handleEvent = function(mapBrowserEvent) {
var stopEvent = false;
let stopEvent = false;
if (mapBrowserEvent.type == EventType.KEYDOWN ||
mapBrowserEvent.type == EventType.KEYPRESS) {
var keyEvent = mapBrowserEvent.originalEvent;
var charCode = keyEvent.charCode;
const keyEvent = mapBrowserEvent.originalEvent;
const charCode = keyEvent.charCode;
if (this.condition_(mapBrowserEvent) &&
(charCode == '+'.charCodeAt(0) || charCode == '-'.charCodeAt(0))) {
var map = mapBrowserEvent.map;
var delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
var view = map.getView();
const map = mapBrowserEvent.map;
const delta = (charCode == '+'.charCodeAt(0)) ? this.delta_ : -this.delta_;
const view = map.getView();
Interaction.zoomByDelta(
view, delta, undefined, this.duration_);
view, delta, undefined, this.duration_);
mapBrowserEvent.preventDefault();
stopEvent = true;
}