zaytri / slime2

Local Chat Overlay System for Twitch
https://slime2.stream/
32 stars 7 forks source link

Extend setData function #11

Open zaytri opened 9 months ago

zaytri commented 9 months ago

Currently the slime2.widget.setData() function is just meant to be used by the saved widget data file, and so it can only set the values for all the widget settings data.

However, I and another developer have already been testing out ways of loading themes by changing some of those setting values. While they can be manipulated directly, it's not recommended to do that, but it somehow works even though it takes a bit of time to load the new value.

setData() can currently be used if getData() is used, manipulating a copy of that data, and inserting that into setData(). It works, but also gets tricky trying to deep copy data. But it does make the data changes instant, which is the goal.

By exposing how individual values are updated, or even an entire group of values, widget developers don't need to worry about deep copying the data, as that will be handled by the slime2 core itself (like it already does).

The new setData() will have 3 different versions, similar to getData()