upd: change event bus
- Make `.subscribeOnce` return listener id - Make `.cancel` and `.isCanceled` methods in `MscEvent` implemented
This commit is contained in:
@@ -18,10 +18,19 @@ public:
|
||||
virtual std::string getName() const = 0;
|
||||
|
||||
/// @brief Is current event is canceled
|
||||
virtual bool isCanceled() const = 0;
|
||||
bool isCanceled() const
|
||||
{
|
||||
return canceled;
|
||||
}
|
||||
|
||||
/// @brief Cancel current event
|
||||
virtual void cancel() = 0;
|
||||
void cancel()
|
||||
{
|
||||
canceled = true;
|
||||
}
|
||||
|
||||
private:
|
||||
bool canceled = false;
|
||||
};
|
||||
|
||||
/// @brief Engine event bus
|
||||
@@ -47,7 +56,7 @@ public:
|
||||
/// @brief Subscribe to specified event and execute once on publish
|
||||
/// @param name event name
|
||||
/// @param listener event handler
|
||||
void subscribeOnce(const std::string &name, Listener listener);
|
||||
SubscriptionId subscribeOnce(const std::string &name, Listener listener);
|
||||
|
||||
/// @brief Unsubscribe listener by its own id
|
||||
/// @param id subscription id
|
||||
|
||||
Reference in New Issue
Block a user