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

Remove window resize event #195

Closed
Maxigong opened this issue Feb 24, 2023 · 2 comments
Closed

Remove window resize event #195

Maxigong opened this issue Feb 24, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Maxigong
Copy link

Hello!
I was wondering if there is a way of removing the windows event it create, because the confetti resize events remain there even after user navigate to another route.

Screenshot 2023-02-24 at 5 52 27 PM

I tried the CDN link and the npm package and the situation is the same.

I am using this code:

const count = 100
    const defaults = {
        origin: { y: 0.35 },
    }
    function fire(particleRatio, opts) {
        confetti(
            Object.assign({}, defaults, opts, {
                particleCount: Math.floor(count * particleRatio),
            })
        )
    }

    fire(0.25, {
        spread: 26,
        startVelocity: 55,
    })
    fire(0.2, {
        spread: 60,
    })
    fire(0.35, {
        spread: 100,
        decay: 0.91,
        scalar: 0.8,
    })
    fire(0.1, {
        spread: 120,
        startVelocity: 25,
        decay: 0.92,
        scalar: 1.2,
    })
    fire(0.1, {
        spread: 120,
        startVelocity: 45,
    })

    setTimeout(() => {
        confetti.reset()
    }, 2000)

@catdad catdad added the bug Something isn't working label Sep 8, 2023
@catdad
Copy link
Owner

catdad commented Sep 8, 2023

This is a bug. The event is supposed to be removed. Currently, if confetti is only fired once, the event will be removed. However, if fired multiple times without waiting for the previous to finish, an event is registered each time but only the last one is removed. This bug needs to be fixed.

catdad added a commit that referenced this issue Sep 28, 2023
registering only a single resize event
@catdad
Copy link
Owner

catdad commented Sep 28, 2023

A fix has been released in 1.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants