Created
June 10, 2020 10:49
-
-
Save takumifukasawa/6bcaa0fea6ec9b020634d82f15e326db to your computer and use it in GitHub Desktop.
ES6: custom webfont loader promise
This file contains hidden or 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
// families: array | |
// urls: array | |
export async function customWebFontLoader({ families, urls }) { | |
return new Promise((resolve, reject) => { | |
WebFont.load({ | |
custom: { | |
families, | |
urls, | |
}, | |
active: () => { | |
resolve() | |
}, | |
inactive: () => { | |
reject() | |
}, | |
}) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment