blob: 86d6b42e4ea868b13320ce4361475199eb4ae850 (
plain)
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
|
// With combined_menu feature flag, there's a benefit to splitting up the import
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()]);
|