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
|
@ -2241,10 +2241,12 @@ None.
|
|||
|
||||
### Props
|
||||
|
||||
| Prop name | Kind | Reactive | Type | Default value | Description |
|
||||
| :-------- | :--------------- | :------- | :------------------ | -------------------------------- | ----------------------------- |
|
||||
| value | <code>let</code> | Yes | <code>any</code> | <code>""</code> | Provide a value to persist |
|
||||
| key | <code>let</code> | No | <code>string</code> | <code>"local-storage-key"</code> | Specify the local storage key |
|
||||
| Prop name | Kind | Reactive | Type | Default value | Description |
|
||||
| :-------- | :-------------------- | :------- | :---------------------- | ---------------------------------------------------- | --------------------------------------------------------------- |
|
||||
| value | <code>let</code> | Yes | <code>any</code> | <code>""</code> | Provide a value to persist |
|
||||
| key | <code>let</code> | No | <code>string</code> | <code>"local-storage-key"</code> | Specify the local storage key |
|
||||
| clearItem | <code>function</code> | No | <code>() => void</code> | <code>() => { localStorage.removeItem(key); }</code> | Remove the persisted key value from the browser's local storage |
|
||||
| clearAll | <code>function</code> | No | <code>() => void</code> | <code>() => { localStorage.clear(); }</code> | Clear all key values from the browser's local storage |
|
||||
|
||||
### Slots
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue