0

So lets say I have

localStorage.setItem('sampleitem','valueone');

If a different script changed 'sampleitem' to a different value, how could I call a function when that happens, without just putting said function to call in the script that it gets changed in?

b blox
  • 15
  • 2
  • Use the [`storage`](https://developer.mozilla.org/en-US/docs/Web/API/Window/storage_event) event. – Sebastian Simon Dec 13 '20 at 00:21
  • 1
    [Duplicate](https://google.com/search?q=site%3Astackoverflow.com+js+listen+for+localStorage+changes) of [Detect any change in localStorage?](https://stackoverflow.com/q/22994774/4642212). – Sebastian Simon Dec 13 '20 at 00:23

0 Answers0