Last active
February 11, 2021 12:46
-
-
Save nmanikiran/6803c2772a96e4b4a354450a7be0f6fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function loadFonts(fontName) { | |
let fontName = fontName || 'myfont'; | |
const font = new FontFace(fontName, `url(${fontName}.woff)`); | |
await font.load(); | |
document.fonts.add(font); | |
document.body.classList.add('fonts-loaded'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment