Files
panel/resources/js/plugins/webfontloader.js

26 lines
705 B
JavaScript
Raw Permalink Normal View History

2025-08-04 16:33:07 +03:30
/**
* plugins/webfontloader.js
*
* webfontloader documentation: https://github.com/typekit/webfontloader
*/
export async function loadFonts() {
const webFontLoader = await import(/* webpackChunkName: "webfontloader" */ 'webfontloader')
webFontLoader.load({
google: {
families: ['Public+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap'],
},
})
}
export default function () {
2025-08-25 12:19:58 +03:30
const idle = window.requestIdleCallback || (cb => setTimeout(cb, 1500))
idle(() => {
try {
loadFonts()
} catch (e) {
// If idle loading fails for any reason, fallback after a short delay
setTimeout(() => loadFonts(), 1000)
}
})
2025-08-04 16:33:07 +03:30
}