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 pull request contains:
Render events
RenderEvents are the events that framework will emit when it interacts with a RenderElement. Just like we can add event listeners for user interactions on DOM elements, we can now add event listeners for framework interactions on RenderElements. Similar to DOM events, we've different types of RenderEvents for different types of interactions which are listed below:
didRender
is a event that's emitted after framework finishes rendering the output of render to the DOM.didUpdate
is a event that's emitted after framework finishes rendering the output of update to the DOM.willUnMount
is a event that's emitted when framework is about to remove the widget from the DOM.didUnMount
is a event that's emitted after framework finishes removing the widget from the DOM.RenderElements can decide to listen to a particular or all render events by adding event listeners.
Comparing RenderEvents with DOM events, there are few differences & restrictions:
These restrictions are temporary and we'll lift them when needed.
RenderEvents are meant to solve the problem of limited control over lifecycle in RenderElements. Previously we were providing a sub-class
WatchfulRenderElement
with hardcoded lifecycle. Now, using the new RenderEvents API, users can add as much or as little lifecycle as they want, to any RenderElement(widget). This new API effectively makesWatchfulRenderElement
obsolete(but we'll keep it for backward compatibility).Benchmark results