本页还没有译文
本页 10 段还没译成日本語,下面显示的是英文原文。createIndexedDB
还没翻译译自英文(tanstack.com)本页 10 段都还没译
function createIndexedDB(options): Promise<IndexedDBInstance>;Defined in: packages/db/src/indexed-db.ts:290
Creates or opens an IndexedDB database with the specified stores. Call this once at app startup, then pass the instance to collections. The connection closes on versionchange so another context can upgrade or delete the database. Affected Collections enter error and retain their rows. Recreate affected Collections with a new instance before further persistence.
All stores are created in a single upgrade transaction, avoiding version race conditions when multiple collections share a database.
Parameters
options
Returns
Promise<IndexedDBInstance>
Example
const db = await createIndexedDB({
name: 'myApp',
version: 1,
stores: ['todos', 'users', 'settings'],
})
const todosCollection = createCollection(
indexedDBCollectionOptions({
db,
name: 'todos',
getKey: (item: { id: string }) => item.id,
})
)AI 翻译查看英文原文