v0.16.0 listen function added
You can now also listen to events on Observed<>
#include <nui/event_system/listen.hpp>
Observed<int> obs;
listen(obs, [](int const& i) {
// ...
});
obs = 7;
Nui::globalEventContext.executeActiveEventsImmediately();
Also observed now accept other (user) event contexts.
Which is useful to decouple app events von UI events.
#include <nui/event_system/listen.hpp>
Nui::EventContext userContext;
Observed<int> obs{userContext};
listen(userContext, obs, [](int const& i) {
// ...
});
obs = 7;
userContext.executeActiveEventsImmediately();