diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-14 18:10:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-14 18:10:46 +0300 |
commit | 8106ac487c3b52471e2ca894c65c13162c2fb1a8 (patch) | |
tree | 12a07c7dd794babe870477f3cd42f15392a82355 /app/assets/javascripts/performance_bar | |
parent | 18873553de98259d0558157f78198b38ddd02b31 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/performance_bar')
-rw-r--r-- | app/assets/javascripts/performance_bar/index.js | 23 |
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; |