Skip to content

v0.4.0 - add signal collections and simplify dynamic signals

Latest
Compare
Choose a tag to compare
@omar-azmi omar-azmi released this 03 Jul 05:46
· 3 commits to main since this release

this release simplifies the management of dynamic signals by making every Accessor<T> function identifiable via its custom id property.
when observer signals are aware of their dependency's id, it makes it easy for them to remove their dependency on them by simply invoking ctx.delEdge(getDepSignalValue.id, thisSignal.id).
another advantage that it gives is the ability add dependencies silently via ctx.addEdge(getDepSignalValue.id, thisSignal.id). previously, you would have to call the getter function with your observer signal's id as the argument so that it would register it as an observer.

in addition, this release introduces two new dynamic signal classes under the new collection_signal submodule:

  • UnisetSignal:
    holds a set of accessors (Set<Accessor<T>>), and when its value is requested, it returns the values of the accessors it is holding (as a Set<T>).
  • ListSignal: holds an array of reference counted accessors (RcList<Accessor<T>>), and when its value is requested, it returns an array of the values of the accessors it is holding (as a List<T>, which is a subclass of Array<T>).

each of the signals above fire an update cycle when the collection is mutated (addition, removal, or swapping of elements).
they also carry on the propagation of an update cycle if one or more of their underlying dependency elements fires an update.

and as always, recall uncle ben's wise words:

with great american allies comes a greater national debt

don't forget to sell your soul to the bankers, for they be lending out moderately-noice foreclosed homes, and brand new hyundai accents.

What's Changed

Full Changelog: v0.3.2...v0.4.0