title: observe localstorage changes in js
body: <p>I have a single-page app in which I need to react on every change in localstorage, it looks something like:</p>
  <pre><code>    MyComponent {
      
      someFuncWhichIsCalledEveryTimeWhenLocalStorageChanges() {
          console.log('local storage changed!');
      }
      
      funcThatChangesLocalStorage() {
          localstorage.setItem('key',val);
          localstorage.getItem('key')
      }
      
      }
  </code></pre>
  <p>And I've tried to use localstorage event:</p>
  <pre><code>window.addEventListener('storage', function(event){
         ...
  });
  </code></pre>
  <p>but that didn't work... so I'm thinking about using <code>Observable&lt;&gt;</code>, just don't know how to implement it properly.</p>