Template Class ExternalBinding

Inheritance Relationships

Base Type

Class Documentation

template<astra::Serializable T>
class ExternalBinding : public Cacao::Reactivity::Dependency

A bridge to access data originating outside of the reactivity system.

Public Functions

inline ExternalBinding(std::function<T(void)> fetcher, bool fluid = false)

Create a new external data binding.

Warning

Using an external binding with fluid enabled will force the UI to redraw on every tick because there will always be dirty state. Use with caution!

Parameters:
  • fetcher – The function that retrieves the current state of the external data

  • fluid – Whether the value should be considered to have always changed

inline operator const T&() const

Get the current value.

Returns:

The current held value

inline const T *operator->() const

Access the current value in a read-only manner.