fitty
fitty copied to clipboard
Use WeakSet to replace fitties arrray
Right now in the code, we are using a plain array to store HTMLElement.
This can cause run-time unable to gabage collector those HTMLElement after the HTMLElement already remove in DOM.
Right now we need to call the unsubscribe on on the fitty instance to instead. But using Weakset, we can let the run-time GC those element for us.
Thanks for the suggestion, that indeed sounds like a nice improvement.
Note that there are probably lots of improvements possible, but at this point if it works I'm mostly okay with not changing it.