@webqit/webflo 0.11.61 → 0.20.2-next.0
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/.github/FUNDING.yml +12 -0
- package/.github/workflows/publish.yml +48 -0
- package/.gitignore +2 -0
- package/LICENSE +2 -2
- package/README.md +71 -2050
- package/package.json +28 -13
- package/site/-/_.md +139 -0
- package/site/-/docs.old.md +2010 -0
- package/site/.vitepress/cache/deps/@braintree_sanitize-url 2.js +93 -0
- package/site/.vitepress/cache/deps/@braintree_sanitize-url.js +93 -0
- package/site/.vitepress/cache/deps/@braintree_sanitize-url.js 2.map +7 -0
- package/site/.vitepress/cache/deps/@braintree_sanitize-url.js.map +7 -0
- package/site/.vitepress/cache/deps/_metadata 2.json +85 -0
- package/site/.vitepress/cache/deps/_metadata.json +85 -0
- package/site/.vitepress/cache/deps/chunk-BUSYA2B4 2.js +9 -0
- package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js +9 -0
- package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js 2.map +7 -0
- package/site/.vitepress/cache/deps/chunk-BUSYA2B4.js.map +7 -0
- package/site/.vitepress/cache/deps/chunk-Q2AYPHVK 2.js +9719 -0
- package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js +9719 -0
- package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js 2.map +7 -0
- package/site/.vitepress/cache/deps/chunk-Q2AYPHVK.js.map +7 -0
- package/site/.vitepress/cache/deps/chunk-QAXAIFA7 2.js +12705 -0
- package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js +12705 -0
- package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js 2.map +7 -0
- package/site/.vitepress/cache/deps/chunk-QAXAIFA7.js.map +7 -0
- package/site/.vitepress/cache/deps/cytoscape 2.js +30278 -0
- package/site/.vitepress/cache/deps/cytoscape-cose-bilkent 2.js +4710 -0
- package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js +4710 -0
- package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js 2.map +7 -0
- package/site/.vitepress/cache/deps/cytoscape-cose-bilkent.js.map +7 -0
- package/site/.vitepress/cache/deps/cytoscape.js +30278 -0
- package/site/.vitepress/cache/deps/cytoscape.js 2.map +7 -0
- package/site/.vitepress/cache/deps/cytoscape.js.map +7 -0
- package/site/.vitepress/cache/deps/dayjs 2.js +285 -0
- package/site/.vitepress/cache/deps/dayjs.js +285 -0
- package/site/.vitepress/cache/deps/dayjs.js 2.map +7 -0
- package/site/.vitepress/cache/deps/dayjs.js.map +7 -0
- package/site/.vitepress/cache/deps/debug 2.js +453 -0
- package/site/.vitepress/cache/deps/debug.js +453 -0
- package/site/.vitepress/cache/deps/debug.js 2.map +7 -0
- package/site/.vitepress/cache/deps/debug.js.map +7 -0
- package/site/.vitepress/cache/deps/package 2.json +3 -0
- package/site/.vitepress/cache/deps/package.json +3 -0
- package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api 2.js +4507 -0
- package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4507 -0
- package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_core 2.js +584 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js +584 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap 2.js +1166 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js +1166 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___@vueuse_integrations_useFocusTrap.js.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js 2.js +1667 -0
- package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js +1667 -0
- package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___mark__js_src_vanilla__js.js.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___minisearch 2.js +1815 -0
- package/site/.vitepress/cache/deps/vitepress___minisearch.js +1815 -0
- package/site/.vitepress/cache/deps/vitepress___minisearch.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vitepress___minisearch.js.map +7 -0
- package/site/.vitepress/cache/deps/vue 2.js +344 -0
- package/site/.vitepress/cache/deps/vue.js +344 -0
- package/site/.vitepress/cache/deps/vue.js 2.map +7 -0
- package/site/.vitepress/cache/deps/vue.js.map +7 -0
- package/site/.vitepress/config.ts +147 -0
- package/site/.vitepress/theme/custom.css +50 -0
- package/site/.vitepress/theme/index.ts +6 -0
- package/site/api/webflo-fetch/FormData.md +0 -0
- package/site/api/webflo-fetch/Headers.md +0 -0
- package/site/api/webflo-fetch/LiveResponse.md +0 -0
- package/site/api/webflo-fetch/Request.md +0 -0
- package/site/api/webflo-fetch/Response.md +0 -0
- package/site/api/webflo-fetch/fetch.md +0 -0
- package/site/api/webflo-routing/HttpCookies.md +0 -0
- package/site/api/webflo-routing/HttpEvent/respondWith.md +1 -0
- package/site/api/webflo-routing/HttpEvent/waitUntil.md +1 -0
- package/site/api/webflo-routing/HttpEvent/waitUntilNavigate.md +1 -0
- package/site/api/webflo-routing/HttpEvent.md +30 -0
- package/site/api/webflo-routing/HttpSession.md +0 -0
- package/site/api/webflo-routing/HttpState.md +0 -0
- package/site/api/webflo-routing/HttpUser.md +0 -0
- package/site/api/webflo-routing/handler/fetch.md +42 -0
- package/site/api/webflo-routing/handler/next.md +54 -0
- package/site/api/webflo-routing/handler.md +119 -0
- package/site/api.md +26 -0
- package/site/contributing.md +16 -0
- package/site/docs/advanced/lifecycles.md +20 -0
- package/site/docs/advanced/redirects.md +0 -0
- package/site/docs/advanced/routing.md +1 -0
- package/site/docs/advanced.md +9 -0
- package/site/docs/concepts/realtime.md +637 -0
- package/site/docs/concepts/rendering.md +60 -0
- package/site/docs/concepts/request-response.md +47 -0
- package/site/docs/concepts/routing.md +656 -0
- package/site/docs/concepts/state.md +44 -0
- package/site/docs/concepts/templates.md +48 -0
- package/site/docs/concepts.md +97 -0
- package/site/docs/getting-started.md +378 -0
- package/site/docs/tech-stack.md +56 -0
- package/site/docs.md +100 -0
- package/site/examples/pwa.md +10 -0
- package/site/examples/web.md +11 -0
- package/site/examples.md +10 -0
- package/site/faq.md +13 -0
- package/site/guides/guide-auth.md +13 -0
- package/site/guides/guide-file-upload.md +11 -0
- package/site/guides/guide-service-worker.md +10 -0
- package/site/guides/tutorial-1-todo.md +24 -0
- package/site/guides.md +15 -0
- package/site/index.md +39 -0
- package/site/public/img/brand/logo-670x670.png +0 -0
- package/site/recipes/realtime.md +11 -0
- package/site/recipes/streaming.md +15 -0
- package/site/reference/cli.md +11 -0
- package/site/reference/config.md +13 -0
- package/site/reference/tools.md +9 -0
- package/src/Context.js +3 -11
- package/src/config-pi/deployment/Env.js +6 -19
- package/src/config-pi/deployment/Layout.js +11 -3
- package/src/config-pi/runtime/Client.js +40 -48
- package/src/config-pi/runtime/Server.js +52 -20
- package/src/config-pi/runtime/client/Worker.js +22 -20
- package/src/config-pi/static/Init.js +57 -0
- package/src/config-pi/static/index.js +2 -0
- package/src/deployment-pi/origins/index.js +1 -1
- package/src/deployment-pi/util.js +161 -0
- package/src/index.js +3 -9
- package/src/init-pi/index.js +117 -0
- package/src/init-pi/templates/pwa/app/handler.server.js +8 -0
- package/src/init-pi/templates/pwa/app/page.html +7 -0
- package/src/init-pi/templates/pwa/package.json +19 -0
- package/src/init-pi/templates/pwa/public/assets/app.css +16 -0
- package/src/init-pi/templates/pwa/public/index.html +39 -0
- package/src/init-pi/templates/pwa/public/manifest.json +29 -0
- package/src/init-pi/templates/web/app/handler.server.js +8 -0
- package/src/init-pi/templates/web/app/page.html +7 -0
- package/src/init-pi/templates/web/package.json +19 -0
- package/src/init-pi/templates/web/public/assets/app.css +16 -0
- package/src/init-pi/templates/web/public/index.html +39 -0
- package/src/runtime-pi/WebfloRuntime.js +350 -0
- package/src/runtime-pi/index.js +3 -10
- package/src/runtime-pi/webflo-client/ClientSideCookies.js +17 -0
- package/src/runtime-pi/webflo-client/ClientSideWorkport.js +63 -0
- package/src/runtime-pi/webflo-client/DeviceCapabilities.js +213 -0
- package/src/runtime-pi/webflo-client/WebfloClient.js +500 -0
- package/src/runtime-pi/webflo-client/WebfloRootClient1.js +206 -0
- package/src/runtime-pi/webflo-client/WebfloRootClient2.js +113 -0
- package/src/runtime-pi/webflo-client/WebfloSubClient.js +118 -0
- package/src/runtime-pi/webflo-client/index.js +17 -0
- package/src/runtime-pi/webflo-client/webflo-codegen.js +469 -0
- package/src/runtime-pi/webflo-client/webflo-devmode.js +243 -0
- package/src/runtime-pi/webflo-client/webflo-embedded.js +50 -0
- package/src/runtime-pi/webflo-fetch/LiveResponse.js +437 -0
- package/src/runtime-pi/webflo-fetch/cookies.js +10 -0
- package/src/runtime-pi/webflo-fetch/fetch.js +16 -0
- package/src/runtime-pi/webflo-fetch/formdata.js +54 -0
- package/src/runtime-pi/webflo-fetch/headers.js +151 -0
- package/src/runtime-pi/webflo-fetch/index.js +5 -0
- package/src/runtime-pi/webflo-fetch/message.js +49 -0
- package/src/runtime-pi/webflo-fetch/request.js +62 -0
- package/src/runtime-pi/webflo-fetch/response.js +110 -0
- package/src/runtime-pi/webflo-fetch/util.js +28 -0
- package/src/runtime-pi/webflo-messaging/WQBroadcastChannel.js +10 -0
- package/src/runtime-pi/webflo-messaging/WQMessageChannel.js +26 -0
- package/src/runtime-pi/webflo-messaging/WQMessageEvent.js +87 -0
- package/src/runtime-pi/webflo-messaging/WQMessagePort.js +38 -0
- package/src/runtime-pi/webflo-messaging/WQRelayPort.js +47 -0
- package/src/runtime-pi/webflo-messaging/WQSockPort.js +113 -0
- package/src/runtime-pi/webflo-messaging/WQStarPort.js +104 -0
- package/src/runtime-pi/webflo-messaging/wq-message-port.js +404 -0
- package/src/runtime-pi/webflo-routing/HttpCookies.js +42 -0
- package/src/runtime-pi/webflo-routing/HttpEvent.js +112 -0
- package/src/runtime-pi/webflo-routing/HttpSession.js +11 -0
- package/src/runtime-pi/webflo-routing/HttpState.js +153 -0
- package/src/runtime-pi/webflo-routing/HttpUser.js +54 -0
- package/src/runtime-pi/webflo-routing/WebfloRouter.js +245 -0
- package/src/runtime-pi/webflo-server/ServerSideCookies.js +19 -0
- package/src/runtime-pi/webflo-server/ServerSideSession.js +38 -0
- package/src/runtime-pi/webflo-server/WebfloServer.js +937 -0
- package/src/runtime-pi/webflo-server/index.js +11 -0
- package/src/runtime-pi/webflo-server/messaging/Client.js +27 -0
- package/src/runtime-pi/webflo-server/messaging/ClientRequestRealtime.js +50 -0
- package/src/runtime-pi/webflo-server/messaging/Clients.js +25 -0
- package/src/runtime-pi/webflo-server/webflo-devmode.js +326 -0
- package/src/runtime-pi/{client → webflo-url}/Url.js +27 -76
- package/src/runtime-pi/webflo-url/index.js +1 -0
- package/src/runtime-pi/webflo-url/urlpattern.js +38 -0
- package/src/runtime-pi/{util-url.js → webflo-url/util.js} +5 -43
- package/src/runtime-pi/webflo-url/xURL.js +94 -0
- package/src/runtime-pi/webflo-worker/WebfloWorker.js +234 -0
- package/src/runtime-pi/webflo-worker/WorkerSideCookies.js +19 -0
- package/src/runtime-pi/webflo-worker/WorkerSideWorkport.js +18 -0
- package/src/runtime-pi/webflo-worker/index.js +11 -0
- package/src/services-pi/index.js +2 -0
- package/src/services-pi/push/index.js +23 -0
- package/src/util.js +10 -0
- package/src/{webflo.js → webflo-cli.js} +4 -4
- package/src/runtime-pi/Application.js +0 -29
- package/src/runtime-pi/Cookies.js +0 -82
- package/src/runtime-pi/HttpEvent.js +0 -107
- package/src/runtime-pi/Router.js +0 -130
- package/src/runtime-pi/Runtime.js +0 -21
- package/src/runtime-pi/client/Application.js +0 -76
- package/src/runtime-pi/client/Context.js +0 -7
- package/src/runtime-pi/client/Router.js +0 -48
- package/src/runtime-pi/client/Runtime.js +0 -525
- package/src/runtime-pi/client/Workport.js +0 -190
- package/src/runtime-pi/client/createStorage.js +0 -58
- package/src/runtime-pi/client/generate.js +0 -481
- package/src/runtime-pi/client/index.js +0 -21
- package/src/runtime-pi/client/worker/Application.js +0 -44
- package/src/runtime-pi/client/worker/Context.js +0 -7
- package/src/runtime-pi/client/worker/Runtime.js +0 -275
- package/src/runtime-pi/client/worker/Workport.js +0 -78
- package/src/runtime-pi/client/worker/index.js +0 -21
- package/src/runtime-pi/server/Application.js +0 -101
- package/src/runtime-pi/server/Context.js +0 -16
- package/src/runtime-pi/server/Router.js +0 -159
- package/src/runtime-pi/server/Runtime.js +0 -558
- package/src/runtime-pi/server/index.js +0 -21
- package/src/runtime-pi/util-http.js +0 -86
- package/src/runtime-pi/xFormData.js +0 -24
- package/src/runtime-pi/xHeaders.js +0 -146
- package/src/runtime-pi/xRequest.js +0 -46
- package/src/runtime-pi/xRequestHeaders.js +0 -109
- package/src/runtime-pi/xResponse.js +0 -33
- package/src/runtime-pi/xResponseHeaders.js +0 -117
- package/src/runtime-pi/xURL.js +0 -105
- package/src/runtime-pi/xfetch.js +0 -23
- package/src/runtime-pi/xxHttpMessage.js +0 -102
- package/src/static-pi/index.js +0 -11
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Handler::`next()`
|
|
2
|
+
|
|
3
|
+
Delegate to next step or make inbound calls.
|
|
4
|
+
|
|
5
|
+
## Signature
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
await next();
|
|
9
|
+
// url can be string or URL
|
|
10
|
+
// url can be relative when string
|
|
11
|
+
// init can be Request instance or Request init
|
|
12
|
+
await next(url, init?);
|
|
13
|
+
await next(request);
|
|
14
|
+
await next({ redirect?: url = next.pathname, with?: init });
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Arguments
|
|
18
|
+
|
|
19
|
+
| Argument | Tyoe | Default | Description |
|
|
20
|
+
| :---------------- | :------------ | :------------ | :---------------------------- |
|
|
21
|
+
|
|
22
|
+
## Properties
|
|
23
|
+
|
|
24
|
+
| Property | Type | Description |
|
|
25
|
+
| :-------------- | :-------------- | ----------------------------------------------------------------- |
|
|
26
|
+
| `next.stepname` | `string` | The name of the next segment in the URL. |
|
|
27
|
+
| `next.pathname` | `string` | The full path _beyond_ the the active step. |
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
::: info See Also
|
|
31
|
+
[`this`](../handler#the-this-context)
|
|
32
|
+
:::
|
|
33
|
+
|
|
34
|
+
## Return Value
|
|
35
|
+
|
|
36
|
+
Depends on the step handler's return value. If:
|
|
37
|
+
|
|
38
|
+
| Condition | Return type |
|
|
39
|
+
| :----------------------------------------- | :---------------------------- |
|
|
40
|
+
| Step handler is generator function | `Generator` object |
|
|
41
|
+
| Step handler is Quantum function | `State` object |
|
|
42
|
+
| Step handler uses `event.respondWith()` | `LiveResponse` |
|
|
43
|
+
| Step handler returns `LiveResponse` | `LiveResponse` |
|
|
44
|
+
| Step handler returns `Response` | `Response` |
|
|
45
|
+
| Step handler returns any other value. | That value |
|
|
46
|
+
|
|
47
|
+
## Differences from `fetch()`:
|
|
48
|
+
|
|
49
|
+
intro
|
|
50
|
+
|
|
51
|
+
| `next()` | `fetch()` |
|
|
52
|
+
| :----------------------------------------- | :--------------------------------------- |
|
|
53
|
+
| Makes only inbound calls. | Can make both inbound or outbound calls. |
|
|
54
|
+
| Inherits current request. | |
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Handler API
|
|
2
|
+
|
|
3
|
+
Handlers are the entry point for all requests in Webflo. This page documents the formal contract for handler functions.
|
|
4
|
+
|
|
5
|
+
## Signature
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
export default async function(event, next, fetch) { /* ... */ }
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Naming
|
|
12
|
+
|
|
13
|
+
A route may provide named exports to map specific HTTP requests to specific handlers:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
export async function GET(event, next, fetch) { /* ... */ }
|
|
17
|
+
export async function POST(event, next, fetch) { /* ... */ }
|
|
18
|
+
// PUT, PATCH, DELETE, OPTIONS, HEAD are also supported
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
| Name | Description |
|
|
22
|
+
| :-------- | :------------------------------------------- |
|
|
23
|
+
| `GET` | Handle HTTP GET requests |
|
|
24
|
+
| `POST` | Handle HTTP POST requests |
|
|
25
|
+
| `PUT` | Handle HTTP PUT requests |
|
|
26
|
+
| `PATCH` | Handle HTTP PATCH requests |
|
|
27
|
+
| `DELETE` | Handle HTTP DELETE requests |
|
|
28
|
+
| `OPTIONS` | Handle HTTP OPTIONS requests |
|
|
29
|
+
| `HEAD` | Handle HTTP HEAD requests |
|
|
30
|
+
|
|
31
|
+
If a named export is not provided for an incoming method, Webflo falls back to the `default` export, if present.
|
|
32
|
+
|
|
33
|
+
## Parameters
|
|
34
|
+
|
|
35
|
+
| Parameter | Type | Description |
|
|
36
|
+
| :-------- | :-------------------------------------------------- | :------------------------------------------------------- |
|
|
37
|
+
| `event` | [`HttpEvent`](/api/webflo-routing/HttpEvent) | Current HTTP event. |
|
|
38
|
+
| `next` | [`next`](/api/webflo-routing/handler/next) | Control delegation function. |
|
|
39
|
+
| `fetch` | [`fetch`](/api/webflo-routing/handler/fetch) | Context-aware fetch API for inbound and outbound calls. |
|
|
40
|
+
|
|
41
|
+
## The `this` Context
|
|
42
|
+
|
|
43
|
+
Contextual properties are available on the `this` context:
|
|
44
|
+
|
|
45
|
+
| Property | Type | Description |
|
|
46
|
+
| :-------------- | :--------- | :---------------------------------------------------------------- |
|
|
47
|
+
| `this.stepname` | `string` | The current directory segment being handled. |
|
|
48
|
+
| `this.pathname` | `string` | The current URL pathname up to the active step. |
|
|
49
|
+
| `this.filename` | `string` | The filename of the executing handler (server-side only). |
|
|
50
|
+
|
|
51
|
+
::: info See also
|
|
52
|
+
[`next`](/api/webflo-routing/handler/next#properties)
|
|
53
|
+
:::
|
|
54
|
+
|
|
55
|
+
## Return Types
|
|
56
|
+
|
|
57
|
+
Handlers can return one of the following:
|
|
58
|
+
|
|
59
|
+
| Type | Description |
|
|
60
|
+
| :-------------- | :---------- |
|
|
61
|
+
| Plain value | A JSON-serializable value or plain object used as the page's data binding. |
|
|
62
|
+
| `Response` | A standard Web Fetch API `Response`. |
|
|
63
|
+
| `LiveResponse` | A streaming/live response that can emit multiple payloads over time. |
|
|
64
|
+
|
|
65
|
+
## Return Styles
|
|
66
|
+
|
|
67
|
+
You can deliver values in two ways:
|
|
68
|
+
|
|
69
|
+
| Style | When to use |
|
|
70
|
+
| :--------------------- | :---------- |
|
|
71
|
+
| `return` | Return a single value (`object`, `Response`, or `LiveResponse`). |
|
|
72
|
+
| `event.respondWith()` | Emit one or more responses, including progressive/streamed updates. See [/docs/concepts/realtime](/docs/concepts/realtime). |
|
|
73
|
+
|
|
74
|
+
### `event.respondWith()` forms
|
|
75
|
+
|
|
76
|
+
- `event.respondWith(data)` — immediately deliver `data`.
|
|
77
|
+
- `event.respondWith(data, { done: false })` — deliver `data` and keep the channel open for more.
|
|
78
|
+
- `event.respondWith(data, (proxy) => { /* write to proxy */ })` — low-level streaming; complete when callback resolves or another `respondWith` is called.
|
|
79
|
+
|
|
80
|
+
## Generator and Live Functions
|
|
81
|
+
|
|
82
|
+
Handlers may be expressed as generators or "live" functions to naturally produce multiple values over time.
|
|
83
|
+
|
|
84
|
+
- Generator: `export function* GET(event) { yield {...}; return {...}; }`
|
|
85
|
+
- Live function: `export live function GET(event) { return {...} }`
|
|
86
|
+
See [/docs/concepts/realtime](/docs/concepts/realtime) for details.
|
|
87
|
+
|
|
88
|
+
## Lifecycle
|
|
89
|
+
|
|
90
|
+
- Streams, generators, and live functions end when `HttpEvent.signal` aborts.
|
|
91
|
+
- The root `HttpEvent` is aborted when all handlers in the subtree complete, the request is aborted, or realtime closes.
|
|
92
|
+
|
|
93
|
+
## Examples
|
|
94
|
+
|
|
95
|
+
Return plain data (rendered into templates via `document.bindings.data`):
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
export async function GET(event) {
|
|
99
|
+
return { title: 'Hello', greeting: 'Hello World!' };
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Return a `Response`:
|
|
104
|
+
|
|
105
|
+
```js
|
|
106
|
+
export async function GET() {
|
|
107
|
+
return Response.json({ ok: true });
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Progressively stream values:
|
|
112
|
+
|
|
113
|
+
```js
|
|
114
|
+
export async function GET(event) {
|
|
115
|
+
event.respondWith({ step: 1 }, { done: false });
|
|
116
|
+
await new Promise(r => setTimeout(r, 200));
|
|
117
|
+
event.respondWith({ step: 2 }); // done by default
|
|
118
|
+
}
|
|
119
|
+
```
|
package/site/api.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# API Reference
|
|
2
|
+
|
|
3
|
+
Browse the API by area.
|
|
4
|
+
|
|
5
|
+
## Routing
|
|
6
|
+
- [Handler](/api/webflo-routing/handler)
|
|
7
|
+
- [HttpEvent](/api/webflo-routing/HttpEvent)
|
|
8
|
+
- [next](/api/webflo-routing/handler/next)
|
|
9
|
+
- [fetch (handler)](/api/webflo-routing/handler/fetch)
|
|
10
|
+
- [HttpState](/api/webflo-routing/HttpState)
|
|
11
|
+
- [HttpSession](/api/webflo-routing/HttpSession)
|
|
12
|
+
- [HttpUser](/api/webflo-routing/HttpUser)
|
|
13
|
+
- [HttpCookies](/api/webflo-routing/HttpCookies)
|
|
14
|
+
|
|
15
|
+
## Fetch
|
|
16
|
+
- [fetch](/api/webflo-fetch/fetch)
|
|
17
|
+
- [Request](/api/webflo-fetch/Request)
|
|
18
|
+
- [Response](/api/webflo-fetch/Response)
|
|
19
|
+
- [LiveResponse](/api/webflo-fetch/LiveResponse)
|
|
20
|
+
- [FormData](/api/webflo-fetch/FormData)
|
|
21
|
+
- [Headers](/api/webflo-fetch/Headers)
|
|
22
|
+
|
|
23
|
+
## Messaging
|
|
24
|
+
- [MessageChannel](/api/webflo-messaging/MessageChannel)
|
|
25
|
+
- [MessagePort](/api/webflo-messaging/MessagePort)
|
|
26
|
+
- [MessageEvent](/api/webflo-messaging/MessageEvent)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for your interest!
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
- Clone the repo
|
|
7
|
+
- Install dependencies
|
|
8
|
+
- Run tests and the docs site
|
|
9
|
+
|
|
10
|
+
## Issues and PRs
|
|
11
|
+
- Open an issue for discussion first where helpful
|
|
12
|
+
- Keep PRs focused; include tests where possible
|
|
13
|
+
|
|
14
|
+
Links:
|
|
15
|
+
- GitHub: https://github.com/webqit/webflo
|
|
16
|
+
- Issues: https://github.com/webqit/webflo/issues
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Webflo Lifecycles
|
|
2
|
+
|
|
3
|
+
A place to see all the various lifecycles
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
+ HttpEvent.signal aborts when
|
|
7
|
+
+ parent event's signal aborts
|
|
8
|
+
+ request's signal aborts
|
|
9
|
+
+ HttpEvent.abort() is called
|
|
10
|
+
+ handler returns, plus all handlers in subtree return; i.e. all handlers complete their lifecycle
|
|
11
|
+
+ root HttpEvent is aborted on any of the above or when Realtime closes
|
|
12
|
+
|
|
13
|
+
+ Realtime closes when
|
|
14
|
+
+ is closed from client
|
|
15
|
+
+ Httpevent.client's `navigation` event fires and is not default-prevented
|
|
16
|
+
+ root event completes its lifecycle
|
|
17
|
+
|
|
18
|
+
+ Quantum state and Generators auto end when
|
|
19
|
+
+ HttpEvent.signal aborts
|
|
20
|
+
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Advanced Routing
|