You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: text/0000-route-manager-api.md
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ This RFC is **not** intended to describe APIs that Ember app developers would ge
50
50
51
51
The minimal API for a Route Manager consists of `capabilities`, `createRoute` and a `getDestroyable` method.
52
52
53
-
```ts
53
+
```typescript
54
54
interfaceRouteManager {
55
55
capabilities:Capabilities;
56
56
@@ -85,7 +85,7 @@ The `getDestroyable` method takes a `RouteStateBucket` and will return the `Dest
85
85
86
86
This follows the same pattern as existing manager implementations. This method will be used by the framework for the Route Base Classes it provides as well as by non-framework code wanting to provide their own Route Manager implementation.
87
87
88
-
```ts
88
+
```typescript
89
89
// Takes a Factory function for the Manager with an Owner argument and
90
90
// the Route base object/class/function for which the manager applies.
91
91
setRouteManager: (
@@ -98,7 +98,7 @@ setRouteManager: (
98
98
99
99
The NavigationState is an interface for the router to pass information to the manager methods. This interface can be extended with capabilities in the future.
100
100
101
-
```ts
101
+
```typescript
102
102
// Passed in to the lifecycle methods
103
103
interfaceNavigationState {
104
104
from:RouteInfo|undefined;
@@ -117,7 +117,7 @@ The `RouteInfo` classes refer to the existing public API `RouteInfo` as specifie
117
117
118
118
The `NavigationActions` interface defines any actions that some of the manager hooks are allowed to call. For now this is just the `cancel` action which stops the current navigation. The implementation details are left to the router, but will at least need to abort the `signal` defined in the [`AsyncNavigationState` interface](#asyncnavigationstate-interface).
119
119
120
-
```ts
120
+
```typescript
121
121
interfaceNavigationActions {
122
122
// Cancels the current navigation
123
123
cancel: () =>void;
@@ -134,7 +134,7 @@ The `signal` is an `AbortSignal` provided by the Router which can be used to rea
134
134
135
135
In addition, the Router will need to provide a method to the Route Managers to retrieve the [`resolvedContext`](#resolvedcontext) of a Route based on its `RouteInfo`.
136
136
137
-
```ts
137
+
```typescript
138
138
// Exposes API used to interact with the active navigation, like awaiting ancestor's async behaviour.
139
139
interfaceAsyncNavigationState {
140
140
// Signal for the current navigation
@@ -160,7 +160,7 @@ This RFC proposes 3 groups of hooks for lifecycle management of a Route.
160
160
161
161
The main lifecycle methods are accompanied by synchronous will*/did* methods. This gives the possibility of implementing lifecycle features like cancelling/preventing a route change, cleaning up after a route branch was fully exited. `update` and `enter` are promise-aware and will be awaited. These methods give the option to do asynchronous work that needs to happen before rendering.
162
162
163
-
```ts
163
+
```typescript
164
164
165
165
interfaceRouteManager {
166
166
// Lifecycle hook called when the Route is about to be entered.
@@ -239,7 +239,7 @@ Any time the Classic Router interfaces with the RouteManager in a way we do not
239
239
240
240
A separate optional capability will be introduced to access the last resolved value of the model hook (equivalent). This leaves open the possibility of asynchronous lifecycle combined with routes accessing ancestor model data through use of the `getResolvedContext` method. A route manager may choose not to implement this capability.
When the `classicInterop` capability is set to `true` the Route Manager will have to provide an implementation for the methods that cross the Route Manager boundary to recreate the current Classic Router behaviour. The following list is a best-effort to find those methods, but it may need to change during implementation. The capability that opts in to these functions is not intended to be implemented by any other future Route Manager.
@@ -275,7 +275,7 @@ The necessary state will be taken from and stored in the passed `RouteStateBucke
275
275
276
276
With the Classic Router, rendering is handled through `RenderState` objects combined with a (scheduled once) call to `router._setOutlets` which updates the render state tree with the new `RenderState` objects from the current routes. This looks something like:
277
277
278
-
```ts
278
+
```typescript
279
279
let render:RenderState= {
280
280
owner,
281
281
name,
@@ -289,7 +289,7 @@ For the Route Manager API we will rework this structure to a generic invokable.
289
289
290
290
The return value of `getInvokable` is an object that needs to have an associated `ComponentManager`.
0 commit comments