let globalImagePath = '' // 全局路径

let ready = false
let callbacks = []

export function setGlobalImagePath(path) {
  globalImagePath = path
  ready = true
  callbacks.forEach(cb => cb(globalImagePath))
  callbacks = []
}

export function waitForGlobalImages() {
  return new Promise(resolve => {
    if (ready) {
      resolve(globalImagePath)
    } else {
      callbacks.push(resolve)
    }
  })
}
