aboutsummaryrefslogtreecommitdiff
path: root/files/es/orphaned/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/es/orphaned/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/es/orphaned/web')
-rw-r--r--files/es/orphaned/web/api/body/formdata/index.html73
-rw-r--r--files/es/orphaned/web/api/body/index.html100
-rw-r--r--files/es/orphaned/web/api/body/json/index.html83
3 files changed, 256 insertions, 0 deletions
diff --git a/files/es/orphaned/web/api/body/formdata/index.html b/files/es/orphaned/web/api/body/formdata/index.html
new file mode 100644
index 0000000000..a7cb72413c
--- /dev/null
+++ b/files/es/orphaned/web/api/body/formdata/index.html
@@ -0,0 +1,73 @@
+---
+title: Body.formData()
+slug: orphaned/Web/API/Body/formData
+tags:
+ - API
+ - BODY
+ - Experimental
+ - Fetch
+ - Fetch API
+ - FormData
+ - Method
+ - NeedsExample
+ - Reference
+translation_of: Web/API/Body/formData
+original_slug: Web/API/Body/formData
+---
+<div>{{APIRef("Fetch")}}</div>
+
+<p>El método <strong><code>formData()</code></strong> de {{domxref("Body")}} mixin toma una cadena {{domxref("Response")}} y la lee completamente. Esto devuelve una promesa que resuelve con un objeto {{domxref("FormData")}}.</p>
+
+<div class="note">
+<p><strong>Nota</strong>: Esto es principalmente relevante en <a href="/en-US/docs/Web/API/ServiceWorker_API">service workers</a>. Si un usuario envia un formulario y un service worker intercepta el request, tu por ejemplo podrás llamar a <code>formData()</code> para obtener un mapeo del tipo llave-valor, modificar algunos campos, luego enviar el formulario al servidor (o utilizarlo localmente).</p>
+</div>
+
+<h2 id="Sintaxis">Sintaxis</h2>
+
+<pre class="syntaxbox">response.formData()
+.then(function(formdata) {
+ // hacer algo con tu formdata
+});</pre>
+
+<h3 id="Parámetros">Parámetros</h3>
+
+<p>Ninguno.</p>
+
+<h3 id="Valor_de_retorno">Valor de retorno</h3>
+
+<p>Una {{domxref("Promise")}} que resuelve con un objeto {{domxref("FormData")}}.</p>
+
+<h2 id="Ejemplo">Ejemplo</h2>
+
+<p>TBD.</p>
+
+<h2 id="Especificaciones">Especificaciones</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Especificación</th>
+ <th scope="col">Estado</th>
+ <th scope="col">Comentario</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Fetch','#dom-body-formdata','formData()')}}</td>
+ <td>{{Spec2('Fetch')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidad_en_navegadores">Compatibilidad en navegadores</h2>
+
+
+
+<p>{{Compat("api.Body.formData")}}</p>
+
+<h2 id="Ver_también">Ver también</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>
diff --git a/files/es/orphaned/web/api/body/index.html b/files/es/orphaned/web/api/body/index.html
new file mode 100644
index 0000000000..346e7b2286
--- /dev/null
+++ b/files/es/orphaned/web/api/body/index.html
@@ -0,0 +1,100 @@
+---
+title: Body
+slug: orphaned/Web/API/Body
+tags:
+ - API
+ - BODY
+ - Experimental
+ - Fetch
+ - Fetch API
+ - Interface
+ - NeedsTranslation
+ - Reference
+ - TopicStub
+ - request
+translation_of: Web/API/Body
+original_slug: 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">const 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; {
+ const 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/es/orphaned/web/api/body/json/index.html b/files/es/orphaned/web/api/body/json/index.html
new file mode 100644
index 0000000000..35f7811df3
--- /dev/null
+++ b/files/es/orphaned/web/api/body/json/index.html
@@ -0,0 +1,83 @@
+---
+title: Body.json()
+slug: orphaned/Web/API/Body/json
+translation_of: Web/API/Body/json
+original_slug: Web/API/Body/json
+---
+<div>{{APIRef("Fetch API")}}</div>
+
+<p>El método <strong><code>json()</code></strong> de {{DOMxRef("Body")}} recibe un flujo de datos {{DOMxRef("Response")}} y lo lee a término. Devuelve una promesa con el cuerpo del texto transformado a {{JSxRef("JSON")}}.</p>
+
+<h2 id="Sintáxis">Sintáxis</h2>
+
+<pre class="syntaxbox"><em>response</em>.json().then(<em>data</em> =&gt; {
+ // do something with your data
+});</pre>
+
+<h3 id="Parámetros">Parámetros</h3>
+
+<p>No.</p>
+
+<h3 id="Valor_devuelto">Valor devuelto</h3>
+
+<p>Una {{jsxref("Promise")}} que se resuelve a un objeto JavaScript. Este objeto puede ser cualquier cosa que pueda ser representada por JSON (un objeto, un array, una cadena de caracteres, un número...).</p>
+
+<h2 id="Example">Example</h2>
+
+<p>In our <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>), we create a new request using the {{DOMxRef("Request.Request", "Request()")}} constructor, then use it to fetch a <code>.json</code> file. When the fetch is successful, we read and parse the data using <code>json()</code>, then read values out of the resulting objects as you'd expect and insert them into list items to display our product data.</p>
+
+<pre class="brush: js highlight[5]">const myList = document.querySelector('ul');
+const myRequest = new Request('products.json');
+
+fetch(myRequest)
+ .then(response =&gt; response.json())
+ .then(data =&gt; {
+ for (const product of data.products) {
+ let listItem = document.createElement('li');
+ listItem.appendChild(
+ document.createElement('strong')
+ ).textContent = product.Name;
+ listItem.append(
+ ` can be found in ${
+ product.Location
+ }. Cost: `
+ );
+ listItem.appendChild(
+ document.createElement('strong')
+ ).textContent = `£${product.Price}`;
+ myList.appendChild(listItem);
+ }
+ });</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName("Fetch", "#dom-body-json", "Body.json()")}}</td>
+ <td>{{Spec2("Fetch")}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility">Browser compatibility</h2>
+
+
+
+<p>{{Compat("api.Body.json")}}</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/CORS">Cross-Origin Resource Sharing (CORS)</a></li>
+ <li><a href="/en-US/docs/Web/HTTP">HTTP</a></li>
+</ul>