Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resize event listener doesn't get removed #2

Open
lu40 opened this issue Dec 12, 2018 · 0 comments
Open

Resize event listener doesn't get removed #2

lu40 opened this issue Dec 12, 2018 · 0 comments

Comments

@lu40
Copy link

lu40 commented Dec 12, 2018

The resize event listener stays attached to window even after the component get's destroyed.

As a workaround I'm removing the event listener in the parent component's beforeDestroy lifecycle hook:

<template>
  <flat-surface-shader ref="shader" ... />
</template>
<script>
export default {
  beforeDestroy() {
    window.removeEventListener('resize', this.$refs.shader.onWindowResize)
  }
}
</script>
@lu40 lu40 changed the title Remove resize event listener on destroying the component Resize event listener doesn't get removed Dec 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant