Static GitHub Issues

[2206] Event listener doesn't remove when route to other page

prev: Show default Progress Bar when loading data
next: Server Middleware, handling Aliases (404 redirection)

I have scroll event listeners in one of the components that I am using on particular Page. The problem is this event listeners is triggered even after I navigate out of this page (where I am using this component). How to fix it? I got console full of errors.

created () {
    if (process.browser) {
      window.addEventListener('scroll', this.parallax)
    }
  },
  destroyed () {
    if (process.browser) {
      window.removeEventListener('scroll', this.parallax)
    }
  }
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1945">#c1945</a>)</em></sub></div>