Skip to content

v0.16.0 listen function added

Compare
Choose a tag to compare
@5cript 5cript released this 15 Jul 13:46
· 68 commits to main since this release
f8a8c69

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();