Skip to content

Commit

Permalink
fix: fix removeEventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
n-d-r-d-g committed Nov 21, 2024
1 parent 82eaa46 commit 266f459
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/frontendmu-nuxt/components/inspira/Vortex.vue
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,22 @@ function renderToScreen(canvas: HTMLCanvasElement, ctx: CanvasRenderingContext2D
ctx.restore()
}
function handleResize() {
const canvas = canvasRef.value
const ctx = canvas?.getContext('2d')
if (canvas && ctx) {
resize(canvas, ctx)
}
}
onMounted(() => {
setup()
window.addEventListener('resize', () => {
const canvas = canvasRef.value
const ctx = canvas?.getContext('2d')
if (canvas && ctx) {
resize(canvas, ctx)
}
})
window.addEventListener('resize', handleResize)
})
onUnmounted(() => {
window.removeEventListener('resize', () => { })
window.removeEventListener('resize', handleResize)
})
</script>

Expand Down

0 comments on commit 266f459

Please sign in to comment.