mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-19 11:59:34 +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
|
@ -15,6 +15,22 @@
|
|||
*/
|
||||
export let value = "";
|
||||
|
||||
/**
|
||||
* Remove the persisted key value from the browser's local storage
|
||||
* @type {() => void}
|
||||
*/
|
||||
export function clearItem() {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all key values from the browser's local storage
|
||||
* @type {() => void}
|
||||
*/
|
||||
export function clearAll() {
|
||||
localStorage.clear();
|
||||
}
|
||||
|
||||
import { onMount, afterUpdate, createEventDispatcher } from "svelte";
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue