@webqit/webflo 0.11.14 → 0.11.15
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/README.md +21 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -453,7 +453,6 @@ export default async function(event, context, next) {
|
|
|
453
453
|
}
|
|
454
454
|
```
|
|
455
455
|
</details>
|
|
456
|
-
|
|
457
456
|
</details>
|
|
458
457
|
|
|
459
458
|
This step-based workflow helps to decomplicate routing and gets us scaling horizontally as our application grows larger.
|
|
@@ -476,6 +475,12 @@ export default function(event, context, next) {
|
|
|
476
475
|
}
|
|
477
476
|
```
|
|
478
477
|
|
|
478
|
+
<details>
|
|
479
|
+
<summary>More details...</summary>
|
|
480
|
+
|
|
481
|
+
> Every handler function has a `this.stepname` and `this.pathname` property. Server-side handlers have an extra `this.dirname` property.
|
|
482
|
+
</details>
|
|
483
|
+
|
|
479
484
|
Additionally, workflows may be designed with as many or as few step functions as necessary; the flow control parameters `next.stepname` and `next.pathname` can be used at any point to handle the rest of an URL that have no corresponding step functions.
|
|
480
485
|
|
|
481
486
|
For example, it is possible to handle all URLs from the root handler alone.
|
|
@@ -642,13 +647,19 @@ my-app
|
|
|
642
647
|
|
|
643
648
|
But, we can also access the route in a way that gets the data rendered into the automatically-paired `index.html` file for a dynamic page response. We'd simply set the [`Accept`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept) header of the request to match `text/html` - e.g. `text/html`, `text/*`, `*/html`, `*/*`, and Webflo will automatically perform [Server-Side Rendering](#client-and-server-side-rendering) to give a page response. (Automatic pairing works the same for nested routes! But top-level `index.html` files are implicitly inherited down the hierarchy.)
|
|
644
649
|
|
|
645
|
-
>
|
|
646
|
-
|
|
650
|
+
<details>
|
|
651
|
+
<summary>How it works...</summary>
|
|
652
|
+
|
|
653
|
+
> The `Accept` header hint is already how browsers make requests on every page load. So, it just works!
|
|
654
|
+
</details>
|
|
647
655
|
|
|
648
656
|
Now, for Single Page Applications, subsequent navigations, after the initial page load, just ask for the data on destination URLs and perform [Client-Side Rendering](#client-and-server-side-rendering) on the same running document. Navigation is sleek and instant!
|
|
649
657
|
|
|
650
|
-
>
|
|
651
|
-
|
|
658
|
+
<details>
|
|
659
|
+
<summary>How it works...</summary>
|
|
660
|
+
|
|
661
|
+
> Unless disabled, [SPA Routing](#spa-routing) is automatically built into your app's JS bundle from the `npm run generate` command. So, it just works!
|
|
662
|
+
</details>
|
|
652
663
|
|
|
653
664
|
With no extra work, your application can function as either a *Multi Page App (MPA)* or a *Single Page App (SPA)*!
|
|
654
665
|
|
|
@@ -1407,7 +1418,7 @@ console.log(document.state.network) // { requesting, remote, error, redirecting,
|
|
|
1407
1418
|
```
|
|
1408
1419
|
|
|
1409
1420
|
<details>
|
|
1410
|
-
<summary>Property: <code>.network.requesting
|
|
1421
|
+
<summary>Property: <code>.network.requesting: null|Object</code></summary>
|
|
1411
1422
|
|
|
1412
1423
|
This property tells when a request is ongoing, in which case it exposes the `params` object used to initiate the request.
|
|
1413
1424
|
|
|
@@ -1426,7 +1437,7 @@ On the UI, this could be used to hide a menu drawer that may have been open.
|
|
|
1426
1437
|
</details>
|
|
1427
1438
|
|
|
1428
1439
|
<details>
|
|
1429
|
-
<summary>Property: <code>.network.remote
|
|
1440
|
+
<summary>Property: <code>.network.remote: null|String</code></summary>
|
|
1430
1441
|
|
|
1431
1442
|
This property tells when a remote request is ongoing - usually the same navigation requests as at `network.requesting`, but when not handled by any client-side route handlers, or when `next()`ed to this point by route handlers. The `remote` property also goes live when a route handler calls the special `fetch()` function that they recieve on their fourth parameter.
|
|
1432
1443
|
|
|
@@ -1443,7 +1454,7 @@ On the UI, this could be used to show/hide a spinner, or progress bar, to provid
|
|
|
1443
1454
|
</details>
|
|
1444
1455
|
|
|
1445
1456
|
<details>
|
|
1446
|
-
<summary>Property: <code>.network.error
|
|
1457
|
+
<summary>Property: <code>.network.error: null|Error</code></summary>
|
|
1447
1458
|
|
|
1448
1459
|
This property tells when a request is *errored* in which case it contains an `Error` instance of the error. For requests that can be retried, the `Error` instance also has a custom `retry()` method.
|
|
1449
1460
|
|
|
@@ -1460,7 +1471,7 @@ On the UI, this could be used to show/hide cute error elements.
|
|
|
1460
1471
|
</details>
|
|
1461
1472
|
|
|
1462
1473
|
<details>
|
|
1463
|
-
<summary>Property: <code>.network.redirecting
|
|
1474
|
+
<summary>Property: <code>.network.redirecting: null|String</code></summary>
|
|
1464
1475
|
|
|
1465
1476
|
This property tells when a client-side redirect is ongoing - see [Scenario 4: Single Page Navigation Requests and Responses](#scenario-4-single-page-navigation-requests-and-responses) - in which case it exposes the destination URL.
|
|
1466
1477
|
|
|
@@ -1477,7 +1488,7 @@ On the UI, this could be used to prevent further interactions with the outgoing
|
|
|
1477
1488
|
</details>
|
|
1478
1489
|
|
|
1479
1490
|
<details>
|
|
1480
|
-
<summary>Property: <code>.network.connectivity
|
|
1491
|
+
<summary>Property: <code>.network.connectivity: String</code></summary>
|
|
1481
1492
|
|
|
1482
1493
|
This property tells of [the browser's ability to connect to the network](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine): `online`, `offline`.
|
|
1483
1494
|
|