simplify local storage sync
This commit is contained in:
@@ -2725,12 +2725,11 @@ page_container %}
|
|||||||
// makes sure that local storage stays up to date
|
// makes sure that local storage stays up to date
|
||||||
// in multiple tabs of the same window
|
// in multiple tabs of the same window
|
||||||
window.addEventListener('storage', e => {
|
window.addEventListener('storage', e => {
|
||||||
console.log(`Key Changed: ${e.key}`)
|
// console.log(`Key Changed: ${e.key}`)
|
||||||
console.log(`New Value: ${e.newValue}`)
|
// console.log(`New Value: ${e.newValue}`)
|
||||||
localStorage.setItem(e.key, e.newValue)
|
|
||||||
// if these were the proofs, reload them
|
// if these were the proofs, reload them
|
||||||
if (e.key == 'cashu.proofs') {
|
if (e.key == 'cashu.proofs') {
|
||||||
this.proofs = JSON.parse(localStorage.getItem('cashu.proofs'))
|
this.proofs = JSON.parse(e.newValue)
|
||||||
}
|
}
|
||||||
// if these were the activeMintUrl, reload
|
// if these were the activeMintUrl, reload
|
||||||
if (e.key == 'cashu.activeMintURL') {
|
if (e.key == 'cashu.activeMintURL') {
|
||||||
|
|||||||
Reference in New Issue
Block a user