feat: Complete fleet — 94 skills across 10+ domains
Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
93
skills/vueuse-functions/references/useIDBKeyval.md
Normal file
93
skills/vueuse-functions/references/useIDBKeyval.md
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
category: '@Integrations'
|
||||
---
|
||||
|
||||
# useIDBKeyval
|
||||
|
||||
Wrapper for [`idb-keyval`](https://www.npmjs.com/package/idb-keyval).
|
||||
|
||||
## Install idb-keyval as a peer dependency
|
||||
|
||||
```bash
|
||||
npm install idb-keyval@^6
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { useIDBKeyval } from '@vueuse/integrations/useIDBKeyval'
|
||||
|
||||
// bind object
|
||||
const { data: storedObject, isFinished } = useIDBKeyval('my-idb-keyval-store', { hello: 'hi', greeting: 'Hello' })
|
||||
|
||||
// update object
|
||||
storedObject.value.hello = 'hola'
|
||||
|
||||
// bind boolean
|
||||
const flag = useIDBKeyval('my-flag', true) // returns Ref<boolean>
|
||||
|
||||
// bind number
|
||||
const count = useIDBKeyval('my-count', 0) // returns Ref<number>
|
||||
|
||||
// awaiting IDB transaction
|
||||
await count.set(10)
|
||||
console.log('IDB transaction finished!')
|
||||
|
||||
// delete data from idb storage
|
||||
storedObject.value = null
|
||||
```
|
||||
|
||||
## Type Declarations
|
||||
|
||||
```ts
|
||||
interface Serializer<T> {
|
||||
read: (raw: unknown) => T
|
||||
write: (value: T) => unknown
|
||||
}
|
||||
export interface UseIDBOptions<T> extends ConfigurableFlush {
|
||||
/**
|
||||
* Watch for deep changes
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
deep?: boolean
|
||||
/**
|
||||
* On error callback
|
||||
*
|
||||
* Default log error to `console.error`
|
||||
*/
|
||||
onError?: (error: unknown) => void
|
||||
/**
|
||||
* Use shallow ref as reference
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
shallow?: boolean
|
||||
/**
|
||||
* Write the default value to the storage when it does not exist
|
||||
*
|
||||
* @default true
|
||||
*/
|
||||
writeDefaults?: boolean
|
||||
/**
|
||||
* Custom data serialization
|
||||
*/
|
||||
serializer?: Serializer<T>
|
||||
}
|
||||
export interface UseIDBKeyvalReturn<T> {
|
||||
data: RemovableRef<T>
|
||||
isFinished: ShallowRef<boolean>
|
||||
set: (value: T) => Promise<void>
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param key
|
||||
* @param initialValue
|
||||
* @param options
|
||||
*/
|
||||
export declare function useIDBKeyval<T>(
|
||||
key: IDBValidKey,
|
||||
initialValue: MaybeRefOrGetter<T>,
|
||||
options?: UseIDBOptions<T>,
|
||||
): UseIDBKeyvalReturn<T>
|
||||
```
|
||||
Reference in New Issue
Block a user