Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Application Dependencies
declare const require: any;
import "./css/simple-grid.min.css";
import "./css/custom.css";
import "lodash";
let devtools = require("devtools-detect");
if (!devtools.open) {
elementChangeClass("console-dis-activate", "no-display", "");
}
window.addEventListener('devtoolschange', function (e) {
const devtoolsIsOpen = e['detail']['open'];
if (devtoolsIsOpen) {
elementChangeClass("console-activate", "no-display", "");
elementChangeClass("console-dis-activate", "", "no-display");
} else {
elementChangeClass("console-dis-activate", "no-display", "");
elementChangeClass("console-activate", "", "no-display");
}
});
function elementChangeClass(idElement: string, removeClass: string, addClass: string) {
removeClass ? document.getElementById(idElement).classList.remove(removeClass) : null;
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import * as devtools from 'devtools-detect';
import { Examples } from './examples/examples.class';
import { environment } from '../environments/environment';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
encapsulation: ViewEncapsulation.None
})
export class AppComponent implements OnInit {
public loaded: boolean;
public devToolsIsOpen: boolean = environment.stackblitz || devtools.open;
public LoggerExamplesTemplate = Examples;
public ngOnInit() {
this.loaded = true;
window.addEventListener('devtoolschange', (e) => {
this.devToolsIsOpen = e['detail']['open'];
});
}
}
checkConsole() {
const isOpen = DevToolsDetect.open;
if (this.state.consoleIsOpen !== isOpen) {
this.setState({
consoleIsOpen: isOpen,
});
}
}
import DevToolsDetect from 'devtools-detect';
import React from 'react';
class ConsoleDetect extends React.Component {
state = {
consoleIsOpen: !DevToolsDetect.open,
};
componentDidMount() {
window.addEventListener('resize', () => {
this.checkConsole();
});
this.checkConsole();
setInterval(() => this.checkConsole(), 500);
}
checkConsole() {
const isOpen = DevToolsDetect.open;
if (this.state.consoleIsOpen !== isOpen) {
this.setState({
consoleIsOpen: isOpen,
});