maciejtreder/angular-universal-pwa

View on GitHub
application/src/bootstrapScripts/firebug.ts

Summary

Maintainability
A
35 mins
Test Coverage
import { environment } from '../environments/environment';
 
Function `fireBug` has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
export const fireBug = () => new Promise((resolve) => {
if (environment.firebug) {
const fb = document.createElement('script');
fb.type = 'text/javascript'; fb.src = '../firebug-lite/build/firebug-lite.js';
fb.innerHTML = `
{
overrideConsole: true,
startOpened: true,
enableTrace: false
}
`;
document.head.appendChild(fb);
const interval = setInterval(() => {
console.log('interval');
if (!!document.getElementById('FirebugUI')) {
clearInterval(interval);
resolve();
}
}, 1);
} else {
resolve();
}
});