Closed semmel closed 3 years ago
Nice idea! I'll try to implement it tomorrow!
On Sat, 12 Dec 2020 at 23:47 Matthias Seemann notifications@github.com wrote:
In it's constructor SiriWave mutates the DOM by appending a
Basically such a method just would have to
dispose() { this.stop(); this.canvas.remove(); // But also: what if this instance is (wrongly) called again by the user? // ... throw on next start() ?}
My use case: I find myself destroying and creating new SiriWaves when my app's layout (i.e. the container element size) changes. So that width and height of the canvas are properly reset for the line animation. However unused canvas elements (owned by probably already garbage-collected SiriWaves) break my layout.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kopiro/siriwave/issues/54, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGNAFCJP2MGGTVE5QEPTQTSUPXIPANCNFSM4UYX35OA .
@semmel what do you think?
Was just looking for this, thanks @kopiro !
In it's constructor SiriWave mutates the DOM by appending a
<canvas>
child to the target container DOM element. Would it not be nice to have somedispose()
method (i.e. something like a destructor) which reverses the effects of the constructor?Basically such a method just would have to
My use case: I find myself destroying and creating new SiriWaves when my app's layout (i.e. the container element size) changes. So that width and height of the canvas are properly reset for the line animation. However unused canvas elements (owned by probably already garbage-collected SiriWaves) break my layout.