mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-10-16 15:45:04 +08:00
Changed toggle to installation toggle instead of logging toggle
This commit is contained in:
@@ -6,19 +6,22 @@
|
||||
* traceroute every time some random script actually accesses window.Bob.
|
||||
*/
|
||||
|
||||
import { mock } from "utils/mock";
|
||||
|
||||
const fakeLogger = mock(console);
|
||||
// import { mock } from "utils/mock";
|
||||
// const fakeLogger = mock(console);
|
||||
|
||||
// stores values that are returned when somebody asks for window.Something
|
||||
window._monitorStorage = window._monitorStorage || {};
|
||||
|
||||
export function installMonitor(globalProp, fallbackValue = null) {
|
||||
|
||||
let label = `window.${globalProp}`;
|
||||
let debug = getMonitorToggle(globalProp);
|
||||
let logger = debug ? console : fakeLogger;
|
||||
|
||||
if (!debug) {
|
||||
return;
|
||||
}
|
||||
|
||||
let label = `window.${globalProp}`;
|
||||
let logger = console;
|
||||
|
||||
// initialize storage with existing value
|
||||
let existingValue = window[globalProp] || fallbackValue;
|
||||
window._monitorStorage[globalProp] = existingValue;
|
||||
@@ -38,7 +41,7 @@ export function installMonitor(globalProp, fallbackValue = null) {
|
||||
logger.trace();
|
||||
logger.groupEnd();
|
||||
return val;
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
logger.warn("Unable to retrieve", globalProp, err);
|
||||
}
|
||||
return null;
|
||||
@@ -56,7 +59,7 @@ export function installMonitor(globalProp, fallbackValue = null) {
|
||||
|
||||
// Proxies the above object definition so we can watch changes to
|
||||
// that object's properties (i.e. window.Thing.prop = "abc")
|
||||
|
||||
|
||||
return new Proxy({}, {
|
||||
get(o, prop) {
|
||||
logger.groupCollapsed(`${label}.${prop} read`);
|
||||
|
||||
Reference in New Issue
Block a user