Changelog - 2026-11-04
BrowserStorage.keys and removeWhere list and sweep keys by prefix
New FeatureIn one line. BrowserStorage.keys({ prefix }) lists the keys of an area, and BrowserStorage.removeWhere({ prefix }) removes the keys that start with a prefix. An app that wants to sweep the keys a previous version wrote no longer has to drop to raw localStorage and give up what BrowserStorage provides.
ts
import { BrowserStorage } from '@venizia/ardor';
const oldKeys = BrowserStorage.keys({ prefix: '@app/store/v1/' });
const removed = BrowserStorage.removeWhere({ prefix: '@app/store/v1/' });What changed
keys({ storage?, prefix? })answers the keys of the area (StorageAreas.LOCALby default), only those that start withprefixwhen it is given. It answers[]where the area is missing or throws.removeWhere({ storage?, prefix })removes every key that starts withprefixand answers how many it removed.prefixis required, and an empty one removes nothing. A call cannot clear a whole area by leaving the prefix out, and there is still noclear().- The session stays out of reach.
removeWhereremoves each key throughremove, so a key under@app/auth/is never removed and is not counted, even when the prefix reaches it (@app/).keysdoes list the session keys, because listing writes nothing. - Subscribers hear about it. Each removed key notifies the subscribers of that key in this tab, as
removedoes. Other tabs hear it through thestorageevent. - Nothing throws. An area that is missing, throws on access, or refuses a removal gives
[]or a count without that key.
Who is affected
- An app that sweeps its own storage keys with raw
localStorage. You can callBrowserStorage.keysandremoveWhereinstead. - All other apps. No action needed.
See Browser storage.