Skip to content

Introduce observable collections

Choose a tag to compare

@FancyNeuron FancyNeuron released this 19 Jul 01:08
· 12 commits to main since this release
1e960ff

New Features

  • New observable collections. ObservableList[S] lets you collect stuff in a list which you can observe for changes. ValueList[S] lets you add Value[S], of which changes you will also be notified when observing the collection
  • Also Added ObservableIntList, IntValueList, ObservableStrList and StrValueList, which provide useful helper methods
  • Variable[S] not has set_delay_notify, a context manager which allows you to set a value, but not have its listeners notified immediately
  • New classes ValuesObservable and ValuesEvent, which allows observing iterables, either as an Iterable or as each individual element
  • Added emit_lazy method to all Events, allowing you to create values, only when the event really is listened to
  • Observables now have various map methods, to map to other observers from other Observables with a mapping function. Events will know if all their observers are themselves unobserved Observables and not emit even then.
  • Value[S]s can now additionally be observed with functions that take two parameters. In that case, the first is the new value and the second is the old value

Improvements

  • Deriving Values from other Values will return a Constant if it is derived from only constants
  • Constant are now equal to each other if their value is equal

Bug fixes

None

Breaking Changes

  • Value[S]s are no longer Observable themselves. Instead, they now provide a observable property
  • Renamed Value[S].is_dependent_on to Value[S].is_derived_from