svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
10.95k stars 1.07k forks source link

It would be nice if we can destroy timeline gracefully. #1295

Closed PVirie closed 10 months ago

PVirie commented 1 year ago

Timeline.terminate()

I am using svg.js to create a math tutorial web blog. It does the job nicely. Just one thing though..

Suppose that we have a script that uses svg.js, consider these conditions:

  1. The script uses a lot of persisting Runners (to make animations revertible).
  2. The script needs to replace and re-populate Timelines with those Runners.

For some reasons, javascript does not clean up Timelines properly and leaves a lot of occupying memory footprints. I have been cleaning up Runners in Timelines manually. But it would be nice if you make an official support for this feature.

So instead of using this:

timeline._runners = [];

It would be nice if we can

timeline.terminate();

I will be happy if you could consider my request. Thank you in advance.

Fuzzyma commented 10 months ago

see https://github.com/svgdotjs/svg.js/commit/29b2bd7f811584380b35434d5bf29913ffe93459 for implementation

sorry that it took so long

oliverschenk commented 9 months ago

Will there be a release version for this?

Fuzzyma commented 2 weeks ago

I am sorry, I somehow forgot to publish all the fixes I made. I just released it: https://github.com/svgdotjs/svg.js/releases/tag/3.2.1