Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: sky/sdk/lib/framework/fn2.dart

Issue 1175753003: Kill onDidMount()/onDidUnmount() in favour of just overriding the relevant methods. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: git pull Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/sdk/lib/framework/fn2.dart
diff --git a/sky/sdk/lib/framework/fn2.dart b/sky/sdk/lib/framework/fn2.dart
index bb20e34269e576335cf1429689044f0e76644bea..a0d5efec57a4177b6fb2d3c42261dbe41e5857bc 100644
--- a/sky/sdk/lib/framework/fn2.dart
+++ b/sky/sdk/lib/framework/fn2.dart
@@ -70,9 +70,9 @@ abstract class UINode {
for (UINode node in _mountedChanged) {
if (node._wasMounted != node._mounted) {
if (node._mounted)
- node._didMount();
+ node.didMount();
else
- node._didUnmount();
+ node.didUnmount();
node._wasMounted = node._mounted;
}
}
@@ -81,8 +81,8 @@ abstract class UINode {
_notifyingMountStatus = false;
}
}
- void _didMount() { }
- void _didUnmount() { }
+ void didMount() { }
+ void didUnmount() { }
RenderObject root;
@@ -886,36 +886,9 @@ abstract class Component extends UINode {
UINode _built;
dynamic _slot; // cached slot from the last time we were synced
- List<Function> _mountCallbacks;
- List<Function> _unmountCallbacks;
-
- void onDidMount(Function fn) {
- if (_mountCallbacks == null)
- _mountCallbacks = new List<Function>();
-
- _mountCallbacks.add(fn);
- }
-
- void onDidUnmount(Function fn) {
- if (_unmountCallbacks == null)
- _unmountCallbacks = new List<Function>();
-
- _unmountCallbacks.add(fn);
- }
-
- void _didMount() {
+ void didMount() {
assert(!_disqualifiedFromEverAppearingAgain);
- super._didMount();
- if (_mountCallbacks != null)
- for (Function fn in _mountCallbacks)
- fn();
- }
-
- void _didUnmount() {
- super._didUnmount();
- if (_unmountCallbacks != null)
- for (Function fn in _unmountCallbacks)
- fn();
+ super.didMount();
}
void remove() {

Powered by Google App Engine
This is Rietveld 408576698