Feature: add hooks to let Views to get notified when they are opened or closed #2493
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.
This is a trivial change which adds virtual methods to View,
onOpen()andonClose(), which are called when the view is opened or closed.This information is already tracked inside the View, but not exposed via the API. There is
didWindowJustOpen()anddidWindowJustClose(), but these fetch and then reset the flag, so they can't be used more than once in a frame (and are sometimes called by the frame, meaning the flag has already been consumed by the time the View's draw callback gets called).The use case here is that I have a View which needs to do some work every time it's shown.