salix/front/core/components/debug-info/index.js

28 lines
677 B
JavaScript
Raw Normal View History

2019-10-23 15:38:35 +00:00
import ngModule from '../../module';
import './style.scss';
/**
* Floating box displaying debugging information.
* Enabled only in development environment.
*/
export default class Controller {
constructor($element, $) {
this.env = process.env.NODE_ENV || 'development';
if (this.env == 'development')
this.interval = setInterval(() => $.$digest(), 2000);
else
$element[0].style.display = 'none';
}
$onDestroy() {
clearInterval(this.interval);
}
}
Controller.$inject = ['$element', '$scope'];
ngModule.component('vnDebugInfo', {
template: require('./index.html'),
controller: Controller
});