Skip to content

Instantly share code, notes, and snippets.

@williammustaffa
Last active December 8, 2020 19:28
Show Gist options
  • Save williammustaffa/ae93a0765ef5766dca2077c105c8196a to your computer and use it in GitHub Desktop.
Save williammustaffa/ae93a0765ef5766dca2077c105c8196a to your computer and use it in GitHub Desktop.
import pubsub from 'pubsub';
import spinner from 'spinner';
import ccLogger from 'ccLogger';
export default {
onLoad() {
const occDebugger = this._occDebugger;
occDebugger.debug('spinner');
occDebugger.debug('topics');
},
debug(featureName) {
switch(featureName) {
case 'spinner':
const _buildCSS = spinner.buildCSS;
const _destroyWithoutDelay = spinner.destroyWithoutDelay;
spinner.buildCSS = function () {
console.warn(`[OCC-DEBUGGER][Spinner created]`, arguments);
_buildCSS.apply(this, arguments);
}
spinner.destroyWithoutDelay = function () {
console.warn(`[OCC-DEBUGGER][Spinner destroyed]`, arguments);
_destroyWithoutDelay.apply(this, arguments);
}
break;
case 'topics':
Object.keys(pubsub.topicNames).map(topicName => {
$.Topic(pubsub.topicNames[topicName]).subscribe((...args) => {
console.warn(`[OCC-DEBUGGER][Topic triggered]${topicName}:`, ...args);
});
});
break;
default:
ccLogger.warn('[OCC-DEBUGGER] Feature not supported.')
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment