Skip to content

Commit 5887381

Browse files
committed
run prettier
1 parent ce67a86 commit 5887381

10 files changed

Lines changed: 233 additions & 190 deletions

File tree

packages/router_js/ARCHITECTURE.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ This is a guide to `router.js`'s internals.
55
`router.js` is a stand-alone microlibrary for client-side routing in JavaScript
66
applications. It's notably used by the [Ember.js Router][Ember Router].
77

8-
98
## Scope of `router.js` and its Dependencies
109

1110
Ember.js's router consumes `router.js`, which in turn consumes
@@ -45,13 +44,12 @@ The [Ember Router][] adds a DSL for declaring your app's routes on top of
4544
`router.js`. It defines the API for the `Ember.Route` class that handles
4645
intelligent defaults, rendering templates, and loading data into controllers.
4746

48-
4947
## History
5048

5149
`router.js` has gone through a few iterations between 2013 and 2014:
5250

53-
* July of 2013 – `router.js` adds promise-awareness.
54-
* Jan 2014 – refactored `router.js`'s primitives to handle corner cases.
51+
- July of 2013 – `router.js` adds promise-awareness.
52+
- Jan 2014 – refactored `router.js`'s primitives to handle corner cases.
5553

5654
### Corner Cases
5755

@@ -64,16 +62,14 @@ intelligent defaults, rendering templates, and loading data into controllers.
6462
avoid re-running the hooks to load Article 123 again.
6563

6664
3. Handle two different approaches to transitions:
67-
68-
* URL based (where a URL is parsed into route parameters that are used to
65+
- URL based (where a URL is parsed into route parameters that are used to
6966
load all the data needed to enter a route (e.g. `{ article_id: 123 }`).
7067

71-
* direct named transition-based, where a route name and any context objects
68+
- direct named transition-based, where a route name and any context objects
7269
are provided (e.g. `transitionTo('article', articleObject)`), and the
7370
provided context object(s) might be promises that can't be serialized
7471
into URL params until they've fulfilled.
7572

76-
7773
## Classes
7874

7975
### `HandlerInfo`
@@ -98,20 +94,24 @@ hierarchy.
9894
`HandlerInfo` is a top-level class with 3 subclasses:
9995

10096
#### `UnresolvedHandlerInfoByParam`
97+
10198
`UnresolvedHandlerInfoByParam` has the URL params stored on it which it can use
10299
to resolve itself (by calling the handler's `beforeModel`/`model`/`afterModel`
103100
hooks).
104101

105102
#### `UnresolvedHandlerInfoByObject`
103+
106104
`UnresolvedHandlerInfoByObject` has a context object, but no URL params.
107105
It can use the context to resolve itself and serialize into URL params once
108106
the context object is fulfilled.
109107

110108
#### `ResolvedHandlerInfo`
109+
111110
`ResolvedHandlerInfo` has calculated its URL params and resolved context/model
112111
object.
113112

114113
#### Public API
114+
115115
`HandlerInfo` has just a `resolve` method which fires all `model` hooks and
116116
ultimately resolves to a `ResolvedHandlerInfo` object.
117117

@@ -124,6 +124,7 @@ The `TransitionState` object consists of an array of `HandlerInfo`s
124124
(though more might be added to it; not sure yet).
125125

126126
#### Public API
127+
127128
It too has a public API consisting only of a `resolve` method that
128129
will loop through all of its `HandlerInfo`s, swapping unresolved
129130
`HandlerInfo`s with `ResolvedHandlerInfo`s as it goes.
@@ -139,14 +140,16 @@ unresolved HandlerInfos.
139140

140141
A `TransitionIntent` describes an attempt to transition.
141142

142-
via URL
143+
via URL
143144
or by named transition (via its subclasses `URLTransitionIntent` and
144145
`NamedTransitionIntent`).
145146

146147
#### `URLTransitionIntent`
148+
147149
A `URLTransitionIntent` has a `url` property.
148150

149151
#### `NamedTransitionIntent`
152+
150153
A `NamedTransitionIntent` has a target route `name` and `contexts` array
151154
property.
152155

0 commit comments

Comments
 (0)