Created
March 30, 2022 08:36
-
-
Save kishoreandra/1713d3ecb85bd854dacc49712de16db7 to your computer and use it in GitHub Desktop.
Listen for changes in local storage - key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener('storage',(e)=>{ | |
if(e.key === 'totalQty'){ | |
const totalQty = localStorage.getItem('totalQty'); | |
if([null,"null","undefined",undefined,'0',0].includes(totalQty)){ | |
// Hide here 🤣 | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment