Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Cant read property 'systemShouldAdvance' of undefined #53

Open
rajeevriitm opened this issue Jul 18, 2018 · 1 comment
Open

Cant read property 'systemShouldAdvance' of undefined #53

rajeevriitm opened this issue Jul 18, 2018 · 1 comment

Comments

@rajeevriitm
Copy link

rajeevriitm commented Jul 18, 2018

I have an instance where I want to animate multiple DOM elements at the same time. The function throwout is run multiple times to achieve this. And once the animation is done I destroy the spring in onSpringAtRest callback. But this throw error Cant read property 'systemShouldAdvance' of undefined if I run the function few times immediately after the other. If I remove the spring.destroy() the error doesnt occur. But I dont want any memory leaks as users might run this function several times.

  springSystem = new Rebound.SpringSystem();
  function Throwout(direction,target,fromX,fromY){
    let throwSpring = this.springSystem.createSpring(500,50);
    throwSpring.addListener({
      onSpringAtRest:  (spring) => {
        this.swipePan = false;
        spring.destroy();
      },
    throwSpring.setCurrentValue(0).setAtRest().setVelocity(throwVelocity).setEndValue(1);
}

@rajeevriitm
Copy link
Author

It throws error if I try to remove spring from springSyetem too

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant