jamClient proxy
jamClient proxy acts as a wrapper which intercept methods been passed to JK.jamClient and logs them
This commit is contained in:
parent
ee54464cfc
commit
7721a9fa39
|
|
@ -2,6 +2,7 @@
|
|||
// !!!! Keep white space after last require !!!!
|
||||
//
|
||||
//= require fakeJamClient
|
||||
//= require jamClientProxy
|
||||
//= require fakeJamClientMessages
|
||||
//= require fakeJamClientRecordings
|
||||
//= require backend_alerts
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
(function (context, $) {
|
||||
|
||||
"use strict";
|
||||
|
||||
context.JK = context.JK || {};
|
||||
context.JK.jamClientProxy = function (obj) {
|
||||
const logger = context.JK.logger;
|
||||
//logger.info("*** JamClient Proxy instance initialized. ***");
|
||||
|
||||
return new Proxy(obj, {
|
||||
get(target, prop) {
|
||||
if (typeof target[prop] === 'function') {
|
||||
return new Proxy(target[prop], {
|
||||
apply: (target, thisArg, argumentsList) => {
|
||||
|
||||
logger.info('*** calling JK.jamClient.', prop, argumentsList);
|
||||
|
||||
return Reflect.apply(target, thisArg, argumentsList);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return Reflect.get(target, prop);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
})(window, jQuery);
|
||||
|
|
@ -85,6 +85,7 @@
|
|||
//= require ../web/affiliate_program
|
||||
//= require ../web/affiliate_links
|
||||
//= require fakeJamClient
|
||||
//= require jamClientProxy
|
||||
//= require fakeJamClientMessages
|
||||
//= require fakeJamClientRecordings
|
||||
//= require JamServer
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
//= require modern/JamServer_copy
|
||||
|
||||
//= require fakeJamClient
|
||||
//= require jamClientProxy
|
||||
//= require fakeJamClientMessages
|
||||
//= require fakeJamClientRecordings
|
||||
|
||||
|
|
|
|||
|
|
@ -1163,6 +1163,9 @@
|
|||
window.jamClient = interceptedJamClient;
|
||||
}
|
||||
|
||||
//wrap jamClient in a proxy wrapper
|
||||
window.jamClient = new JK.jamClientProxy(window.jamClient);
|
||||
|
||||
}
|
||||
|
||||
// pass in 'arguments' in a fail callback of a $.ajax
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@
|
|||
//= require web/affiliate_program
|
||||
//= require web/affiliate_links
|
||||
//= require fakeJamClient
|
||||
//= require jamClientProxy
|
||||
//= require fakeJamClientMessages
|
||||
//= require fakeJamClientRecordings
|
||||
//= require JamServer
|
||||
|
|
|
|||
Loading…
Reference in New Issue