luci-base: luci.js: enable strict mode

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich 2019-04-05 07:51:16 +02:00
parent 74ccea6fa2
commit 8a8e8e0aac

View file

@ -1,4 +1,6 @@
(function(window, document, undefined) { (function(window, document, undefined) {
'use strict';
/* Object.assign polyfill for IE */ /* Object.assign polyfill for IE */
if (typeof Object.assign !== 'function') { if (typeof Object.assign !== 'function') {
Object.defineProperty(Object, 'assign', { Object.defineProperty(Object, 'assign', {
@ -136,7 +138,7 @@
* HTTP Request helper * HTTP Request helper
*/ */
Headers = Class.extend({ var Headers = Class.extend({
__name__: 'LuCI.XHR.Headers', __name__: 'LuCI.XHR.Headers',
__init__: function(xhr) { __init__: function(xhr) {
var hdrs = this.headers = {}; var hdrs = this.headers = {};
@ -157,7 +159,7 @@
} }
}); });
Response = Class.extend({ var Response = Class.extend({
__name__: 'LuCI.XHR.Response', __name__: 'LuCI.XHR.Response',
__init__: function(xhr, url, duration) { __init__: function(xhr, url, duration) {
this.ok = (xhr.status >= 200 && xhr.status <= 299); this.ok = (xhr.status >= 200 && xhr.status <= 299);
@ -179,7 +181,7 @@
} }
}); });
Request = Class.singleton({ var Request = Class.singleton({
__name__: 'LuCI.Request', __name__: 'LuCI.Request',
interceptors: [], interceptors: [],
@ -428,7 +430,7 @@
originalCBIInit = null, originalCBIInit = null,
classes = {}; classes = {};
LuCI = Class.extend({ var LuCI = Class.extend({
__name__: 'LuCI', __name__: 'LuCI',
__init__: function(env) { __init__: function(env) {
@ -582,6 +584,8 @@
/* load dependencies and instantiate class */ /* load dependencies and instantiate class */
return Promise.all(depends).then(function(instances) { return Promise.all(depends).then(function(instances) {
var _factory, _class;
try { try {
_factory = eval( _factory = eval(
'(function(window, document, L%s) { %s })\n\n//# sourceURL=%s\n' '(function(window, document, L%s) { %s })\n\n//# sourceURL=%s\n'
@ -1045,7 +1049,7 @@
}) })
}); });
XHR = Class.extend({ var XHR = Class.extend({
__name__: 'LuCI.XHR', __name__: 'LuCI.XHR',
__init__: function() { __init__: function() {
if (window.console && console.debug) if (window.console && console.debug)