export const getAssetURL = (image: string) => {
  // 参数一: 相对路径
  // 参数二: 当前路径的URL
  return new URL(`../assets/${image}`, import.meta.url).href
}

export const debounce = (fn: Function, delay: number) => {
  let timeoutId: NodeJS.Timeout
  return (...args: any[]) => {
    clearTimeout(timeoutId)
    timeoutId = setTimeout(() => {
      fn(...args)
    }, delay)
  }
}
