mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-19 20:09:35 +00:00
feat(local-storage): add clearItem, clearAll instance methods
This commit is contained in:
parent
aa5200cff5
commit
6c478b8193
7 changed files with 111 additions and 8 deletions
12
types/LocalStorage/LocalStorage.d.ts
vendored
12
types/LocalStorage/LocalStorage.d.ts
vendored
|
@ -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<
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue