Web
Indexed Db Storage
createIndexedDbStorage()
Creates a reactive handle for an IndexedDB object store.
IndexedDB is asynchronous, so the handle keeps an in-memory cache that
get() reads synchronously. The cache is hydrated from IndexedDB on
creation (await ready to know when), and changes made via set() /
clear() are persisted asynchronously. When BroadcastChannel is
available, changes are synced across tabs while there is at least one
subscriber.
Examples
Vanilla
import { } from 'seitu/web'
import * as from 'zod'
const = ({
: 'app',
: {
: .().(),
: .({ : .(['light', 'dark']) }),
},
: { : null, : { : 'light' } },
})
.() // { token: null, preferences: { theme: 'light' } }
await . // value hydrated from IndexedDB
await .({ : 'abc' })
.() // { token: 'abc', preferences: { theme: 'light' } }
.(.)React
'use client'
import { } from 'seitu/web'
import { } from 'seitu/react'
import * as from 'zod'
const = ({
: 'app',
: { : .(), : .() },
: { : 0, : '' },
})
export default function () {
const = ()
return (
<>
<>{.}</>
<>{.}</>
</>
)
}