A
A
Alexander2019-08-13 10:13:46
Vue.js
Alexander, 2019-08-13 10:13:46

Is it possible to monitor LocalStorage?

Hello! There are 2 tabs (same page). In one tab, I change the value of the name key in localStorage. Is it possible to somehow catch this change on the second tab (Computed, Watch)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene Chefranov, 2019-08-13
@Dgacarda

created() {
    window.addEventListener('storage', () => {
      //что-то делаем когда меняется local storage
    })
  },

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question