@jsenv/navi 0.29.457 → 0.29.458
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dev/jsenv_navi.js +22 -6
- package/dist/dev/jsenv_navi.js.map +2 -2
- package/dist/jsenv_navi.js +22 -6
- package/dist/jsenv_navi.js.map +2 -2
- package/docs/dynamic_import.md +18 -0
- package/package.json +1 -1
package/docs/dynamic_import.md
CHANGED
|
@@ -145,6 +145,24 @@ that asks for nothing (`() => true`).
|
|
|
145
145
|
`routeAction(route, action, undefined, { prefetch: false })` keeps a param-less
|
|
146
146
|
read that is not worth a hover out of it.
|
|
147
147
|
|
|
148
|
+
A page only some readers may download keeps its condition out of the params and
|
|
149
|
+
says it with `when`: a condition on app state, not on the address, so the link
|
|
150
|
+
still prefetches the action, as long as the condition holds when the pointer
|
|
151
|
+
arrives. A reader for whom it does not hold downloads nothing, not even by
|
|
152
|
+
typing the address.
|
|
153
|
+
|
|
154
|
+
```js
|
|
155
|
+
const VIDEO_PAGE_CODE = routeAction(
|
|
156
|
+
VIDEO_ROUTE,
|
|
157
|
+
() => import("./video_page.jsx").then((m) => m.VideoPage),
|
|
158
|
+
undefined,
|
|
159
|
+
{ when: () => meIsAdminSignal.value },
|
|
160
|
+
);
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
The link reads `when` as it is at that moment, not as the address it leads to
|
|
164
|
+
will make it: a condition that reads the address belongs in the params.
|
|
165
|
+
|
|
148
166
|
A prefetch that fails is not reported: nothing on screen asked for it. The failure
|
|
149
167
|
stays on the action, and a failed action is run again by whatever asks next — the
|
|
150
168
|
arrival, which shows its own failure, and every later hover alike.
|