// eslint-disable-next-line import/prefer-default-export
export function progressive(src: string) {
  return new Promise((RES, REJ) => {
    const img = new Image()
    img.onload = () => {
      RES(true)
    }
    img.onerror = () => {
      REJ()
    }
    img.src = src
    if (img.complete) {
      RES(true)
    }
  })
}
