Skip to content

New module: storage.js

Choose a tag to compare

@awangga awangga released this 11 Sep 22:15
· 87 commits to main since this release

Adds storage.js for localStorage and sessionStorage:

  • setLocal, setLocalWithExpireDay / Hour / Second, getLocal, deleteLocal
  • setSession, getSession, deleteSession

Values are serialized with JSON automatically, so objects and arrays can be stored directly. localStorage entries support an optional expiry, which the browser's own API does not provide; expired entries are removed on read.

Docs: https://croot.js.org/docs/storage