fitty icon indicating copy to clipboard operation
fitty copied to clipboard

Use WeakSet to replace fitties arrray

Open chigia001 opened this issue 1 year ago • 1 comments

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.

chigia001 avatar Dec 07 '23 04:12 chigia001

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.

rikschennink avatar Dec 07 '23 11:12 rikschennink