27 bool AppInitializedCalled {};
28 bool AppClosingCalled {};
51 if (handlers.AppInitializedCalled)
54 handlers.appInitialized.push_back(std::move(callback));
66 if (handlers.AppClosingCalled)
69 handlers.appClosing.push_back(std::move(callback));
82 handlers.AppInitializedCalled =
true;
84 std::vector<std::function<void()>> callbacks;
85 std::swap(callbacks, handlers.appInitialized);
87 for (
auto& callback : callbacks)
100 handlers.AppClosingCalled =
true;
102 std::vector<std::function<void()>> callbacks;
103 std::swap(callbacks, handlers.appClosing);
105 for (
auto& callback : callbacks)
void HandleAppInitialized()
An object that sends messages to an open-ended list of subscribed callbacks.
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
CallbackReturn Publish(const Message &message)
Send a message to connected callbacks.
A move-only handle representing a connection to a Publisher.
EventHandlers & GetEventHandlers()
void OnAppClosing(std::function< void()> callback)
Observer::Subscription OnAppIdle(std::function< void()> callback)
void OnAppInitialized(std::function< void()> callback)
void swap(std::unique_ptr< Alg_seq > &a, std::unique_ptr< Alg_seq > &b)
std::vector< std::function< void()> > appInitialized
std::vector< std::function< void()> > appClosing