@wcstack/fetch 4.8.0 → 4.10.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/README.ja.md +2 -0
- package/README.md +2 -0
- package/package.json +1 -1
package/README.ja.md
CHANGED
|
@@ -307,6 +307,8 @@ get fieldErrors() {
|
|
|
307
307
|
> 入ります。`error` を観測せず `value` のみをバインドしている場合、リクエスト失敗時に
|
|
308
308
|
> 直前の成功値が消えます。失敗を明示的に扱うには `error` をバインドしてください。
|
|
309
309
|
|
|
310
|
+
**`value` がどの応答か、リクエストがいつ終わったか。** `value` は次の応答が届くまで前の応答のままです。新しい `url` で要求が進んでいる間も、`url` が空になっても(ルートを出た、getter がその間 `null` を返した)消えません — 戻ってきたとき、新しい応答が届くまでは前の項目の応答が入っています。`value` を「このページの項目」として読むページは、そうであることを確かめてください(`v && v.id === this.entryId`)。また `value` と `status` は state の出力なので、同じ値をもう一度書いてもバインディングも `$watch` も発火しません。`status` への `$watch` は、`204` を返す 1 回目の `DELETE` は見ますが、2 回目は見ません。応答ごとに動くには応答のイベントを受けてください — `eventToken.value: done` と `$on: { done(state, event) { … } }`: `event` は `wcs-fetch:response` で、`detail` は `{ value, status, objectURL }`。HTTP のエラーも含めて応答ごとに、`loading` が `false` になる前に送られます — あるいは `loading` が `true` から `false` になるのを見て `error` を読んでください。
|
|
311
|
+
|
|
310
312
|
### 入力 / コマンドサーフェス
|
|
311
313
|
|
|
312
314
|
HTML、JS、または `@wcstack/state` バインディングからリクエスト実行を制御します:
|
package/README.md
CHANGED
|
@@ -308,6 +308,8 @@ These properties represent the result of the current request and are the main ob
|
|
|
308
308
|
> successful value disappears when a request fails. Bind `error` to handle the
|
|
309
309
|
> failure case explicitly.
|
|
310
310
|
|
|
311
|
+
**Which response `value` holds, and when a request finished.** `value` is the last response until the next one lands: a new `url` does not clear it while the new request is in flight, and neither does an empty `url` (a route left, a getter that returned `null` meanwhile) — on the way back, the previous item's response is there until the new one arrives. A page that reads `value` as "the item this page shows" checks that it is (`v && v.id === this.entryId`). And `value` and `status` are state outputs: the same value written again fires no binding and no `$watch`, so a `$watch` on `status` sees the first `DELETE` that answers `204` and not the second. To act on every response, take the response event — `eventToken.value: done` with `$on: { done(state, event) { … } }`: `event` is `wcs-fetch:response`, whose `detail` is `{ value, status, objectURL }`, dispatched for every response, an HTTP error included, before `loading` turns `false` — or watch `loading` going from `true` to `false` and read `error`.
|
|
312
|
+
|
|
311
313
|
### Input / command surface
|
|
312
314
|
|
|
313
315
|
These properties control request execution from HTML, JS, or `@wcstack/state` bindings:
|
package/package.json
CHANGED