Skip to content

Instantly share code, notes, and snippets.

@takumifukasawa
Created June 10, 2020 10:49
Show Gist options
  • Save takumifukasawa/6bcaa0fea6ec9b020634d82f15e326db to your computer and use it in GitHub Desktop.
Save takumifukasawa/6bcaa0fea6ec9b020634d82f15e326db to your computer and use it in GitHub Desktop.
ES6: custom webfont loader promise
// 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