aboutsummaryrefslogtreecommitdiff
path: root/files/zh-tw/web
diff options
context:
space:
mode:
authorMDN <actions@users.noreply.github.com>2021-07-01 00:37:12 +0000
committerMDN <actions@users.noreply.github.com>2021-07-01 00:37:12 +0000
commitb0a393384aa4021c915e6a650c75ff328a054cb2 (patch)
tree5f049f0db1c3b87c9d8ea12564cf7bc43b0e8f07 /files/zh-tw/web
parent3f2eea0abf998516fe98d64da8da53a03d36c3ee (diff)
downloadtranslated-content-b0a393384aa4021c915e6a650c75ff328a054cb2.tar.gz
translated-content-b0a393384aa4021c915e6a650c75ff328a054cb2.tar.bz2
translated-content-b0a393384aa4021c915e6a650c75ff328a054cb2.zip
[CRON] sync translated content
Diffstat (limited to 'files/zh-tw/web')
-rw-r--r--files/zh-tw/web/api/body/index.html99
-rw-r--r--files/zh-tw/web/api/body/json/index.html73
2 files changed, 0 insertions, 172 deletions
diff --git a/files/zh-tw/web/api/body/index.html b/files/zh-tw/web/api/body/index.html
deleted file mode 100644
index 82ba54e53d..0000000000
--- a/files/zh-tw/web/api/body/index.html
+++ /dev/null
@@ -1,99 +0,0 @@
----
-title: Body
-slug: Web/API/Body
-tags:
- - API
- - BODY
- - Experimental
- - Fetch
- - Fetch API
- - Interface
- - NeedsTranslation
- - Reference
- - TopicStub
- - request
-translation_of: Web/API/Body
----
-<div>{{ APIRef("Fetch") }}</div>
-
-<p><span class="seoSummary">The <strong><code>Body</code></strong> {{glossary("mixin")}} of the <a href="/en-US/docs/Web/API/Fetch_API">Fetch API</a> represents the body of the response/request, allowing you to declare what its content type is and how it should be handled.</span></p>
-
-<p><code>Body</code> is implemented by both {{domxref("Request")}} and {{domxref("Response")}}. This provides these objects with an associated <dfn>body</dfn> (a <a href="/en-US/docs/Web/API/Streams_API">stream</a>), a <dfn>used flag</dfn> (initially unset), and a <dfn>MIME type</dfn> (initially the empty byte sequence).</p>
-
-<h2 id="Properties">Properties</h2>
-
-<dl>
- <dt>{{domxref("Body.body")}} {{readonlyInline}}</dt>
- <dd>A simple getter used to expose a {{domxref("ReadableStream")}} of the body contents.</dd>
- <dt>{{domxref("Body.bodyUsed")}} {{readonlyInline}}</dt>
- <dd>A {{domxref("Boolean")}} that indicates whether the body has been read.</dd>
-</dl>
-
-<h2 id="Methods">Methods</h2>
-
-<dl>
- <dt>{{domxref("Body.arrayBuffer()")}}</dt>
- <dd>Takes a {{domxref("Response")}} stream and reads it to completion. It returns a promise that resolves with an {{domxref("ArrayBuffer")}}.</dd>
- <dt>{{domxref("Body.blob()")}}</dt>
- <dd>Takes a {{domxref("Response")}} stream and reads it to completion. It returns a promise that resolves with a {{domxref("Blob")}}.</dd>
- <dt>{{domxref("Body.formData()")}}</dt>
- <dd>Takes a {{domxref("Response")}} stream and reads it to completion. It returns a promise that resolves with a {{domxref("FormData")}} object.</dd>
- <dt>{{domxref("Body.json()")}}</dt>
- <dd>Takes a {{domxref("Response")}} stream and reads it to completion. It returns a promise that resolves with the result of parsing the body text as {{jsxref("JSON")}}.</dd>
- <dt>{{domxref("Body.text()")}}</dt>
- <dd>Takes a {{domxref("Response")}} stream and reads it to completion. It returns a promise that resolves with a {{domxref("USVString")}} (text). The response is <em>always</em> decoded using UTF-8.</dd>
-</dl>
-
-<h2 id="Examples">Examples</h2>
-
-<p>The example below uses a simple fetch call to grab an image and display it in an {{htmlelement("img")}} tag. You'll notice that since we are requesting an image, we need to run {{domxref("Body.blob","Body.blob()")}} ({{domxref("Response")}} implements body) to give the response its correct MIME type.</p>
-
-<h3 id="HTML_Content">HTML Content</h3>
-
-<pre class="brush: html">&lt;img class="my-image" src="https://wikipedia.org/static/images/project-logos/frwiki-1.5x.png"&gt;
-</pre>
-
-<h3 id="JS_Content">JS Content</h3>
-
-<pre class="brush: js">var myImage = document.querySelector('.my-image');
-fetch('https://upload.wikimedia.org/wikipedia/commons/7/77/Delete_key1.jpg')
- .then(res =&gt; res.blob())
- .then(res =&gt; {
- var objectURL = URL.createObjectURL(res);
- myImage.src = objectURL;
-});</pre>
-
-<p>{{ EmbedLiveSample('Examples', '100%', '250px') }}</p>
-
-<h2 id="Specifications">Specifications</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- <tr>
- <td>{{SpecName('Fetch','#body-mixin','Body')}}</td>
- <td>{{Spec2('Fetch')}}</td>
- <td> </td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="Browser_compatibility">Browser compatibility</h2>
-
-
-
-<p>{{Compat("api.Body")}}</p>
-
-<h2 id="See_also">See also</h2>
-
-<ul>
- <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
- <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
- <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
-</ul>
-
-<p> </p>
diff --git a/files/zh-tw/web/api/body/json/index.html b/files/zh-tw/web/api/body/json/index.html
deleted file mode 100644
index 70085afff7..0000000000
--- a/files/zh-tw/web/api/body/json/index.html
+++ /dev/null
@@ -1,73 +0,0 @@
----
-title: Body.json()
-slug: Web/API/Body/json
-translation_of: Web/API/Body/json
----
-<div>{{APIRef("Fetch")}}</div>
-
-<p>{{domxref("Body")}} mixin 的 <strong><code>json()</code></strong> 會拿 {{domxref("Response")}} stream 並完整地讀取他。它會回傳一個能夠實現 (resolve) 把回傳的結果的 body text 解析成 {{jsxref("JSON")}} 型別的 Promise。</p>
-
-<h2 id="語法">語法</h2>
-
-<pre class="brush: js notranslate">response.json().then(function(data) {
- // do something with your data
-});</pre>
-
-<h3 id="參數">參數</h3>
-
-<p>None.</p>
-
-<h3 id="回傳">回傳</h3>
-
-<p>一個能夠實現 (resolve) 把回傳的結果的 body text 解析成 JSON 型別的 Promise。這可以是任何能夠被 JSON 呈現的資料型別 — 物件 (object), 陣列 (array), 字串 (string), 數字 (number)...</p>
-
-<h2 id="範例">範例</h2>
-
-<p>在我們的範例 <a href="https://github.com/mdn/fetch-examples/tree/master/fetch-json">fetch json example</a> (run <a href="http://mdn.github.io/fetch-examples/fetch-json/">fetch json live</a>) 中,我們用 constructor {{domxref("Request.Request")}} 產生一個新的請求,並且用它去取回 <code>.json</code> 檔案。 當成功取回 (fetch) 時,我們使用 <code>json()</code> 去讀取跟解析資料,然後依照我們期待的把回傳的結果物件 (resulting objects) 裡讀取到的數值存入 list 中藉以顯示我們的產品資料。</p>
-
-<pre class="brush: js notranslate">var myList = document.querySelector('ul');
-
-var myRequest = new Request('products.json');
-
-fetch(myRequest)
- .then(function(response) { return response.json(); })
- .then(function(data) {
- for (var i = 0; i &lt; data.products.length; i++) {
- var listItem = document.createElement('li');
- listItem.innerHTML = '&lt;strong&gt;' + data.products[i].Name + '&lt;/strong&gt; can be found in ' +
- data.products[i].Location +
- '. Cost: &lt;strong&gt;£' + data.products[i].Price + '&lt;/strong&gt;';
- myList.appendChild(listItem);
- }
- });</pre>
-
-<h2 id="規範">規範</h2>
-
-<table class="standard-table">
- <tbody>
- <tr>
- <th scope="col">Specification</th>
- <th scope="col">Status</th>
- <th scope="col">Comment</th>
- </tr>
- <tr>
- <td>{{SpecName('Fetch','#dom-body-json','json()')}}</td>
- <td>{{Spec2('Fetch')}}</td>
- <td></td>
- </tr>
- </tbody>
-</table>
-
-<h2 id="瀏覽器相容性">瀏覽器相容性</h2>
-
-
-
-<p>{{Compat("api.Body.json")}}</p>
-
-<h2 id="參見">參見</h2>
-
-<ul>
- <li><a href="/en-US/docs/Web/API/ServiceWorker_API">ServiceWorker API</a></li>
- <li><a href="/en-US/docs/Web/HTTP/Access_control_CORS">HTTP access control (CORS)</a></li>
- <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
-</ul>