aboutsummaryrefslogtreecommitdiffstats
path: root/htdocs/src/js/utilities/helpers.js
diff options
context:
space:
mode:
Diffstat (limited to 'htdocs/src/js/utilities/helpers.js')
-rw-r--r--htdocs/src/js/utilities/helpers.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/htdocs/src/js/utilities/helpers.js b/htdocs/src/js/utilities/helpers.js
new file mode 100644
index 0000000..470c49c
--- /dev/null
+++ b/htdocs/src/js/utilities/helpers.js
@@ -0,0 +1,19 @@
+/**
+ * Check the size of the current viewport.
+ * @returns {Boolean} True if viewport lower than 1200px; false otherwise.
+ */
+function isSmallVw() {
+ return window.innerWidth < 1200;
+}
+
+/**
+ * Check if /assets/styles.js exists (Webpack dev mode).
+ * @returns {Boolean} True if style.js exists ; false otherwise.
+ */
+async function isStyleJsExists() {
+ const filePath = 'assets/js/style.js';
+ const response = await fetch(filePath);
+ return response.status === 200;
+}
+
+export { isSmallVw, isStyleJsExists };