Open candela97 opened 1 year ago
Using a WeakSet
is also possible (idea from SO).
With this you keep your processing information entirely on AS' side, avoiding manipulation from Steam's side and cluttering of the DOM.
On the negative side, it's another data structure (though not too bad, space is Θ(1) and operations are Θ(n) on average, if using hash tables) and prevents proper debugging.
Debugging is always possible though by setting a breakpoint to where the checking happens.
Another problem with using class names - e.g. in FDLCCheckboxes
we use a mutation observer to watch for class attribute changes when users add DLCs to their wishlists via ds dropdowns, but the class name added by highlighting will trigger a useless observer entry.
Task Description
We often need to mark nodes as "checked" to avoid processing the same node twice in callback features. The way we do it now is add a class name and check for that in each feature, but it gets messy and is not ideal for e.g. the wishlist where there're a handful of features that target the same node one after another. We should figure out a unified solution that can be reused everywhere if possible.
Symbol
: These can be set/read via property access and we can export a single symbol and use it everywhere, but are not convenient for debugging.data-
attribute: There is precedent for this inFHideSpamComments
. These are similar to class names and are more idiomatic, while retaining the debugging experience.