title: How to clean localeStorage only after closing the browser (VueJs)?
body: <p>The question was: &quot;How to clean localeStorage only after closing the browser (not closing the browser tab and reloading the page). And this must be implemented in the Vue component.
  Found the following solution (<a href="https://stackoverflow.com/questions/39128931/clear-localstorage-on-tab-browser-close-but-not-on-refresh">Clear localStorage on tab/browser close but not on refresh</a>):</p>
  <pre><code>window.onbeforeunload = function (e) {
      window.onunload = function () {
              window.localStorage.isMySessionActive = &quot;false&quot;;
      }
      return undefined;
  };
  
  window.onload = function () {
              window.localStorage.isMySessionActive = &quot;true&quot;;
  };
  </code></pre>
  <p>But I do not understand how to properly and where to call these listeners.</p>