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

Unified Diff: sky/sdk/lib/widgets/widget.dart

Issue 1182463007: Re-wire up the back button (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
« no previous file with comments | « sky/sdk/lib/widgets/navigator.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/widget.dart
diff --git a/sky/sdk/lib/widgets/widget.dart b/sky/sdk/lib/widgets/widget.dart
index e96f3d22db5626d9a5c5e2e8480c1eb3a85678ef..537537640a3e91c07a9c5683ec9c2f1208a698ec 100644
--- a/sky/sdk/lib/widgets/widget.dart
+++ b/sky/sdk/lib/widgets/widget.dart
@@ -771,6 +771,21 @@ class WidgetAppView extends AppView {
}
abstract class App extends Component {
+ void _handleEvent(sky.Event event) {
+ if (event.type == 'back')
+ onBack();
+ }
+
+ void didMount() {
+ super.didMount();
+ WidgetAppView.appView.addEventListener(_handleEvent);
+ }
+
+ void didUnmount() {
+ super.didUnmount();
+ WidgetAppView.appView.removeEventListener(_handleEvent);
+ }
+
// Override this to handle back button behavior in your app
void onBack() { }
}
« no previous file with comments | « sky/sdk/lib/widgets/navigator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698