feat(local-storage): add clearItem, clearAll instance methods

This commit is contained in:
Eric Y Liu 2021-07-09 11:57:11 -07:00
commit 6c478b8193
7 changed files with 111 additions and 8 deletions

View file

@ -13,6 +13,18 @@ export interface LocalStorageProps {
* @default ""
*/
value?: any;
/**
* Remove the persisted key value from the browser's local storage
* @default () => { localStorage.removeItem(key); }
*/
clearItem?: () => void;
/**
* Clear all key values from the browser's local storage
* @default () => { localStorage.clear(); }
*/
clearAll?: () => void;
}
export default class LocalStorage extends SvelteComponentTyped<