safer logging in JS utilRegistry
This commit is contained in:
parent
d43fbca0c3
commit
32bc5f4852
@ -4,7 +4,7 @@
|
||||
var registeredUtils = [];
|
||||
var activeUtilInstances = [];
|
||||
|
||||
var DEBUG_MODE = 2;
|
||||
var DEBUG_MODE = /localhost/.test(window.location.href) && 2;
|
||||
|
||||
// Registry
|
||||
// (revealing module pattern)
|
||||
@ -26,10 +26,8 @@
|
||||
* @param util Object Utility that should be added to the registry
|
||||
*/
|
||||
function registerUtil(util) {
|
||||
if (DEBUG_MODE > 0) {
|
||||
console.log('registering util "' + util.name + '"');
|
||||
}
|
||||
if (DEBUG_MODE > 2) {
|
||||
console.log('registering util "' + util.name + '"');
|
||||
console.log({ util });
|
||||
}
|
||||
|
||||
@ -49,6 +47,11 @@
|
||||
}
|
||||
|
||||
function setupAllUtils() {
|
||||
if (DEBUG_MODE > 1) {
|
||||
console.info('registered js utilities:');
|
||||
console.table(registeredUtils);
|
||||
}
|
||||
|
||||
registeredUtils.forEach(function(util) {
|
||||
setupUtil(util);
|
||||
});
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
window.utils = window.utils || {};
|
||||
|
||||
/**
|
||||
*
|
||||
* Check All Checkbox Utility
|
||||
|
||||
Loading…
Reference in New Issue
Block a user