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