Skip to main content

clear

还没翻译译自英文(tanstack.com)本页 11 段都还没译

function clear(objectStore): Promise<void>;

Defined in: packages/db/src/indexed-db-wrapper.ts:531

Removes all items from an object store.

Parameters

objectStore

IDBObjectStore

The IDBObjectStore to clear

Returns

Promise<void>

A promise that resolves when all items are removed

Example

await executeTransaction(db, 'todos', 'readwrite', async (tx, stores) => {
  await clear(stores.todos)
  console.log('All todos cleared')
})