auto-claude: subtask-3-2 - Add JSDoc to fontLoader.ts
This commit is contained in:
+15
-2
@@ -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');
|
||||||
|
|||||||
Reference in New Issue
Block a user