mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 20:54:22 -06:00
34b4f7c717
* Chore: reduces strict error in OptionPicker tests * Chore: reduces strict errors in FormDropdownCtrl * Chore: reduces has no initializer and is not definitely assigned in the constructor errors * Chore: reduces has no initializer and is not definitely assigned in the constructor errors * Chore: lowers strict count limit * Tests: updates snapshots * Tests: updates snapshots * Chore: updates after PR comments * Refactor: removes throw and changes signature for DashboardSrv.getCurrent
31 lines
763 B
TypeScript
31 lines
763 B
TypeScript
import { GrafanaRootScope } from 'app/routes/GrafanaCtrl';
|
|
|
|
export class Profiler {
|
|
panelsRendered = 0;
|
|
enabled?: boolean = undefined;
|
|
$rootScope?: GrafanaRootScope = undefined;
|
|
window?: any = undefined;
|
|
|
|
init(config: any, $rootScope: GrafanaRootScope) {
|
|
this.$rootScope = $rootScope;
|
|
this.window = window;
|
|
|
|
if (!this.enabled) {
|
|
return;
|
|
}
|
|
}
|
|
|
|
renderingCompleted() {
|
|
// add render counter to root scope
|
|
// used by image renderer to know when panel has rendered
|
|
this.panelsRendered += 1;
|
|
|
|
// this window variable is used by backend rendering tools to know
|
|
// all panels have completed rendering
|
|
this.window.panelsRendered = this.panelsRendered;
|
|
}
|
|
}
|
|
|
|
const profiler = new Profiler();
|
|
export { profiler };
|