Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/performance_bar/index.js')
-rw-r--r--app/assets/javascripts/performance_bar/index.js23
1 files changed, 4 insertions, 19 deletions
diff --git a/app/assets/javascripts/performance_bar/index.js b/app/assets/javascripts/performance_bar/index.js
index 8ecf5971392..0d5c294ea56 100644
--- a/app/assets/javascripts/performance_bar/index.js
+++ b/app/assets/javascripts/performance_bar/index.js
@@ -11,6 +11,9 @@ import initPerformanceBarLog from './performance_bar_log';
Vue.use(Translate);
const initPerformanceBar = (el) => {
+ if (!el) {
+ return undefined;
+ }
const performanceBarData = el.dataset;
return new Vue({
@@ -126,25 +129,7 @@ const initPerformanceBar = (el) => {
});
};
-let loadedPeekBar = false;
-function loadBar() {
- const jsPeek = document.querySelector('#js-peek');
- if (!loadedPeekBar && jsPeek) {
- loadedPeekBar = true;
- initPerformanceBar(jsPeek);
- }
-}
-
-// If js-peek is not loaded when this script is executed, this call will do nothing
-// If this is the case, then it will loadBar on DOMContentLoaded. We would prefer it
-// to be initialized before the DOMContetLoaded event in order to pick up all the
-// requests sent from the page.
-loadBar();
-
-document.addEventListener('DOMContentLoaded', () => {
- loadBar();
-});
-
+initPerformanceBar(document.querySelector('#js-peek'));
initPerformanceBarLog();
export default initPerformanceBar;