const loadImage = (name, path, resources) => {
    return new Promise((resolve, reject) => {
        const img = new Image()

        img.onload = () => {
            resources[name] = {
                type: 'image',
                data: img
            }

            resolve(img)
        }

        img.onerror = reject

        img.src = path
    })
}

export default loadImage
