import FontFaceObserver from 'fontfaceobserver'

const loadFont = (name, path) => {
    const fontStyle = document.createElement('style')
    fontStyle.innerHTML = `@font-face { font-family: "${name}"; src: url("${path}"); }`
    document.querySelector('head').appendChild(fontStyle)

    return (new FontFaceObserver(name)).load().then(() => {
        resources[name] = {
            type: 'font',
            data: ''
        }
    })
}
