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
+10 -10
View File
@@ -26,10 +26,10 @@ export function loadFeaturesXhr(url, format, success, failure) {
* @this {ol.source.Vector|ol.VectorTile}
*/
function(extent, resolution, projection) {
var xhr = new XMLHttpRequest();
const xhr = new XMLHttpRequest();
xhr.open('GET',
typeof url === 'function' ? url(extent, resolution, projection) : url,
true);
typeof url === 'function' ? url(extent, resolution, projection) : url,
true);
if (format.getType() == FormatType.ARRAY_BUFFER) {
xhr.responseType = 'arraybuffer';
}
@@ -40,9 +40,9 @@ export function loadFeaturesXhr(url, format, success, failure) {
xhr.onload = function(event) {
// status will be 0 for file:// urls
if (!xhr.status || xhr.status >= 200 && xhr.status < 300) {
var type = format.getType();
const type = format.getType();
/** @type {Document|Node|Object|string|undefined} */
var source;
let source;
if (type == FormatType.JSON || type == FormatType.TEXT) {
source = xhr.responseText;
} else if (type == FormatType.XML) {
@@ -55,7 +55,7 @@ export function loadFeaturesXhr(url, format, success, failure) {
}
if (source) {
success.call(this, format.readFeatures(source,
{featureProjection: projection}),
{featureProjection: projection}),
format.readProjection(source), format.getLastExtent());
} else {
failure.call(this);
@@ -87,12 +87,12 @@ export function loadFeaturesXhr(url, format, success, failure) {
*/
export function xhr(url, format) {
return loadFeaturesXhr(url, format,
/**
/**
* @param {Array.<ol.Feature>} features The loaded features.
* @param {ol.proj.Projection} dataProjection Data projection.
* @this {ol.source.Vector}
*/
function(features, dataProjection) {
this.addFeatures(features);
}, /* FIXME handle error */ nullFunction);
function(features, dataProjection) {
this.addFeatures(features);
}, /* FIXME handle error */ nullFunction);
}