auto-claude: subtask-3-2 - Add JSDoc to fontLoader.ts

This commit is contained in:
2026-01-25 06:42:26 +01:00
parent 4d9e0d3a29
commit b4f9ac947b
+15 -2
View File
@@ -1,4 +1,13 @@
// Font loading utility to ensure fonts are loaded before showing content /**
* Font Loading Utility
* Ensures fonts are loaded before showing content to prevent FOUT/FOIT
*/
/**
* Preload fonts asynchronously
* Uses the Font Loading API to ensure Inter font is loaded
* Falls back to system fonts on error
*/
export const preloadFonts = async () => { export const preloadFonts = async () => {
if ('fonts' in document) { if ('fonts' in document) {
try { try {
@@ -12,7 +21,11 @@ export const preloadFonts = async () => {
} }
}; };
// Call this function as early as possible /**
* Initialize font loading process
* Should be called as early as possible in the application lifecycle
* Adds loading state and fallback timeout to prevent indefinite loading
*/
export const initializeFonts = () => { export const initializeFonts = () => {
// Add loading class immediately // Add loading class immediately
document.documentElement.classList.add('fonts-loading'); document.documentElement.classList.add('fonts-loading');