summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/nav/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/nav/index.js')
-rw-r--r--app/assets/javascripts/nav/index.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/app/assets/javascripts/nav/index.js b/app/assets/javascripts/nav/index.js
index 646ce3f0ecf..86d6b42e4ea 100644
--- a/app/assets/javascripts/nav/index.js
+++ b/app/assets/javascripts/nav/index.js
@@ -1,12 +1,28 @@
-export const initTopNav = async () => {
+// 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;
}
- // With combined_menu feature flag, there's a benefit to splitting up the import
- const { mountTopNav } = await import(/* webpackChunkName: 'top_nav' */ './mount');
+ 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()]);