Fix: delete entry from 'localStorage'
This commit is contained in:
parent
d1fed39fcb
commit
22c8a45012
1 changed files with 4 additions and 0 deletions
|
@ -30,6 +30,10 @@ export class LocalStorageSource {
|
||||||
const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:" + key)
|
const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:" + key)
|
||||||
|
|
||||||
source.addCallback((data) => {
|
source.addCallback((data) => {
|
||||||
|
if(data === undefined || data === "" || data === null){
|
||||||
|
localStorage.removeItem(key)
|
||||||
|
return
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(key, data)
|
localStorage.setItem(key, data)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in a new issue