Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the pull request
This PR adds an event infrastructure, which is the foundation for de-coupling certain aspects in apps from their implementation. Currently this only means that
Apps define some events, which can be subscribed to. In the future, we might want to add events to other types to allow for a more flexible implementation.Events are handled similar to those of .NET. Defining an event is straightforward:
Here
EventArgsis a default, empty event argument structure, that can be inherited from. Note that all arguments must be passed as members of such a structure and only one structure per event is allowed. The event host may call events using either of the following:To subscribe to a event, a client can call either
Event<>::addor theoperator+=:Event handlers are stored as
std::functionobjects, so usingstd::bindto regular functions also works. If an event needs to be unsubscribed from, the client can store a token, that identifies the event subscription:All samples have been updated to use the the events
startup,initializingandresizing. Overloadinginitialize,runorresizeis no longer allowed.