spark.clearLocal
function clearLocal(): Promise<void>Clear all data from local browser storage (IndexedDB).
Removes all stored data at once. Useful for:
- Resetting to fresh state
- Freeing up storage space
- Testing or debugging
- User-initiated "reset" action
This is permanent and irrevocable. All locally cached data will be lost. Consider prompting the user before calling this.
Returns
Promise<void>– Promise that resolves when all data is clearedExamples
// Full reset - clear everything
await spark.clearLocal();
console.log('All local data cleared');
// Clear on user request
async function handleResetButton() {
if (confirm('Clear all cached data?')) {
await spark.clearLocal();
// Reload or reinitialize application
}
}See Also
- deleteLocal - Delete single key
- listLocal - List all keys before clearing