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

@@ -2,7 +2,7 @@
* @module ol/net
*/
import {getUid} from './index.js';
var _ol_net_ = {};
const _ol_net_ = {};
/**
@@ -17,8 +17,8 @@ var _ol_net_ = {};
* callback. Default is 'callback'.
*/
_ol_net_.jsonp = function(url, callback, opt_errback, opt_callbackParam) {
var script = document.createElement('script');
var key = 'olc_' + getUid(callback);
const script = document.createElement('script');
const key = 'olc_' + getUid(callback);
function cleanup() {
delete window[key];
script.parentNode.removeChild(script);
@@ -26,7 +26,7 @@ _ol_net_.jsonp = function(url, callback, opt_errback, opt_callbackParam) {
script.async = true;
script.src = url + (url.indexOf('?') == -1 ? '?' : '&') +
(opt_callbackParam || 'callback') + '=' + key;
var timer = setTimeout(function() {
const timer = setTimeout(function() {
cleanup();
if (opt_errback) {
opt_errback();