Skip to content

Releases: hazae41/glacier

1.0.37 - The time update

27 Aug 12:11
Compare
Choose a tag to compare

BREAKING CHANGES

  • Changed useSingle() and useScroll() to use new time parameters
useSingle(key, fetcher, { cooldown, timeout, expiration })
useScroll(scroller, fetcher, { cooldown, timeout, expiration })

CHANGES

  • You can now use an expiration delay in your handles
useSingle(key, fetcher, { expiration:  60 * 1000 })
useScroll(scroller, fetcher, { expiration: 60 * 1000 })
  • You can now return a cooldown time in your fetcher
async function fetchAsJson<T>(url: string) {
  const res = await fetch(url)
  if (!res.ok) throw new Error(await res.text())

  const data = await res.json() as T
  const cooldown = Date.now() + 5000
  const expiration = Date.now() + (60 * 1000)
  return { data, cooldown, expiration }
}
  • You can now use time parameters in CoreProvider
function MyWrapper() {
  return <XSWR.CoreProvider
    cooldown={1000}
    timeout={5000}
    expiration={60 * 1000}>
    <MyAwesomeApp />
  </XSWR.CoreProvider>
}

1.0.36 - The ES6 update

26 Aug 19:43
Compare
Choose a tag to compare

Now ES6 compatible, tree-shakeable and side-effects free!

https://bundlephobia.com/package/@hazae41/[email protected]