refactor: Modularize JavaScript Code into Separate Files
All checks were successful
Build and Push Docker Image / docker (push) Successful in 9s
All checks were successful
Build and Push Docker Image / docker (push) Successful in 9s
This commit is contained in:
15
public/js/utils.js
Normal file
15
public/js/utils.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// Shared small utilities
|
||||
|
||||
export function showToast(msg) {
|
||||
const el = document.getElementById('toast');
|
||||
if (!el) return;
|
||||
el.textContent = msg;
|
||||
el.style.opacity = '1';
|
||||
setTimeout(() => {
|
||||
el.style.opacity = '0';
|
||||
}, 1200);
|
||||
}
|
||||
|
||||
export function wire(el, type, handler, options) {
|
||||
if (el) el.addEventListener(type, handler, options);
|
||||
}
|
||||
Reference in New Issue
Block a user