debian-mirror-gitlab/app/assets/javascripts/nav/index.js

29 lines
686 B
JavaScript
Raw Normal View History

2021-09-04 01:27:46 +05:30
// With combined_menu feature flag, there's a benefit to splitting up the import
const importModule = () => import(/* webpackChunkName: 'top_nav' */ './mount');
const tryMountTopNav = async () => {
2021-06-08 01:23:25 +05:30
const el = document.getElementById('js-top-nav');
if (!el) {
return;
}
2021-09-04 01:27:46 +05:30
const { mountTopNav } = await importModule();
2021-06-08 01:23:25 +05:30
mountTopNav(el);
};
2021-09-04 01:27:46 +05:30
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()]);