0

I want to do this code or similar. I need to react when the value of an item of localStorage or sessionStorage change.

export default {
  name: "demo",
  watch: {
    'localStorage.getItem("item")': function () {
        console.log("LocalStorege item changed!");
     }
  }
};

Now I'm using a setIntervale to polling de localStorage, but it isn't inefficient.

Thanks!

0 Answers0