A brief tutorial on using MutationObserver with Bricksforge

I know a more complete set of documentation is on its way for 1.0, but MutationObserver has been kicking my butt and any progress has been through lots of trial and error.

I’ve been getting stuck in loops where using Flip alongside MutationObserver has, of course, created mutations to observe and more flips :sweat_smile:

There are quite a few moving parts with this rather powerful feature and an overview of how/why they work in the context of Bricksforge would be really useful for me.
Failing that, some tooltips for the major switches would definitely be handy!

1 Like

Yeah, mutation can fire often and limiting them to specific attributes or children can help with that. Also in the event that you fire I usually test for the thing I am looking for. In regular JS you could set the state in a data attribute or read the value from style. Another nice way is to enable old value in MutationObserver and compare that against the current value. This more of general feedback. I would need to test these techniques with the BricksForge implementation, though.


Thanks Max! I think I get your drift! :slight_smile:

I reckon I’ll be best served by experimenting with MutationObserver in regular JS for a while longer.