Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 26df7c2

Browse files
vicbvsavkin
authored andcommitted
doc(routing): event.allowLeave() is on the PreLeave event since 0.4.21
Closes #1469
1 parent 87fcd1e commit 26df7c2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/routing/module.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,29 @@
8080
* EditRecipe(RouteProvider routeProvider) {
8181
* RouteHandle route = routeProvider.route.newHandle();
8282
* _loadRecipe(route);
83-
* route.onLeave.listen((RouteEvent event) {
83+
* route.onPreLeave.listen((RouteEvent event) {
8484
* event.allowLeave(_checkIfOkToLeave());
8585
* });
8686
* }
8787
*
8888
* /// Check if the editor has unsaved contents and if necessary ask
8989
* /// the user if OK to leave this page.
90-
* Future<bool> _checkIfOkToLeave() {/* ... */}
90+
* Future<bool> _checkIfOkToLeave() => /* ... */;
9191
*
9292
* detach() {
9393
* route.discard();
9494
* }
9595
* }
9696
*
97-
* [Route.onLeave] event is triggered when the browser is routed from an
97+
* [Route.onPreLeave] event is triggered when the browser is routed from an
9898
* active route to a different route. The active route can delay and
9999
* potentially veto the navigation by passing a [Future<bool>] to
100-
* [RouteEvent.allowLeave].
100+
* [RoutePreLeaveEvent.allowLeave].
101101
*
102102
* Notice that we create a [RouteHandle] for our route. [RouteHandle] are
103103
* a convenient wrapper around [Route] that makes unsubscribing route events
104104
* easier. For example, notice that we didn't need to manually call
105-
* [StreamSubscription.cancel] for subscription to [Route.onLeave]. Calling
105+
* [StreamSubscription.cancel] for subscription to [Route.onPreLeave]. Calling
106106
* [RouteHandle.discard] unsubscribes all listeners created for the handle.
107107
*
108108
* ## Hierarchical Routes

lib/routing/ng_view.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class NgView implements DetachAware, RouteProvider {
177177
* route.onEnter.listen((RouteEvent e) {
178178
* // Do something when the route is activated.
179179
* });
180-
* route.onLeave.listen((RouteEvent e) {
180+
* route.onPreLeave.listen((RouteEvent e) {
181181
* // Do something when the route is de-activated.
182182
* e.allowLeave(allDataSaved());
183183
* });
@@ -193,7 +193,7 @@ class NgView implements DetachAware, RouteProvider {
193193
* }
194194
* }
195195
*
196-
* If user component is used outside of ng-view directive then
196+
* If user component is used outside of `ng-view` directive then
197197
* injected [RouteProvider] will be null.
198198
*/
199199
abstract class RouteProvider {

0 commit comments

Comments
 (0)