All files / app/assets/javascripts/nav index.js

0% Statements 0/16
0% Branches 0/4
0% Functions 0/4
0% Lines 0/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32                                                               
// TODO: With the combined_menu feature flag removed, there's likely a better
// way to slice up the async import (i.e., include trigger in main bundle, but
// async import subviews. Don't do this at the cost of UX).
// See https://gitlab.com/gitlab-org/gitlab/-/issues/336042
const importModule = () => import(/* webpackChunkName: 'top_nav' */ './mount');
 
const tryMountTopNav = async () => {
  const el = document.getElementById('js-top-nav');
 
  if (!el) {
    return;
  }
 
  const { mountTopNav } = await importModule();
 
  mountTopNav(el);
};
 
const tryMountTopNavResponsive = async () => {
  const el = document.getElementById('js-top-nav-responsive');
 
  if (!el) {
    return;
  }
 
  const { mountTopNavResponsive } = await importModule();
 
  mountTopNavResponsive(el);
};
 
export const initTopNav = async () => Promise.all([tryMountTopNav(), tryMountTopNavResponsive()]);