diff options
author | MDN <actions@users.noreply.github.com> | 2021-09-01 00:52:00 +0000 |
---|---|---|
committer | MDN <actions@users.noreply.github.com> | 2021-09-01 00:52:00 +0000 |
commit | af3288b106f44aaaa2c80d499ec669383d6f7203 (patch) | |
tree | 6d5a402249e4e8a83820c2592887062ec9202d79 /files/es/web/api/caches/index.html | |
parent | 1768b43f574673545e1f2a20e92a27b050a2bb53 (diff) | |
download | translated-content-af3288b106f44aaaa2c80d499ec669383d6f7203.tar.gz translated-content-af3288b106f44aaaa2c80d499ec669383d6f7203.tar.bz2 translated-content-af3288b106f44aaaa2c80d499ec669383d6f7203.zip |
[CRON] sync translated content
Diffstat (limited to 'files/es/web/api/caches/index.html')
-rw-r--r-- | files/es/web/api/caches/index.html | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/files/es/web/api/caches/index.html b/files/es/web/api/caches/index.html new file mode 100644 index 0000000000..db56d9611d --- /dev/null +++ b/files/es/web/api/caches/index.html @@ -0,0 +1,128 @@ +--- +title: WindowOrWorkerGlobalScope.caches +slug: Web/API/caches +translation_of: Web/API/WindowOrWorkerGlobalScope/caches +original_slug: Web/API/WindowOrWorkerGlobalScope/caches +--- +<p>{{APIRef()}}{{SeeCompatTable}}</p> + +<p>La propiedad de sólo-lectura <code><strong>caches</strong></code>, de la interfaz {{domxref("WindowOrWorkerGlobalScope")}}, devuelve el objeto {{domxref("CacheStorage")}} asociado al contexto actual. Este objeto habilita funcionalidades como guardar assets para su utilización <em>offline</em>, y generar respuestas personalizadas a las peticiones.</p> + +<h2 id="Sintaxis">Sintaxis</h2> + +<pre class="syntaxbox">var <em>myCacheStorage</em> = self.caches; // or just caches +</pre> + +<h3 id="Valor">Valor</h3> + +<p>Un objeto {{domxref("CacheStorage")}}.</p> + +<h2 id="Ejemplo">Ejemplo</h2> + +<p>El siguiente ejemplo muestra la forma en la que utilizarías una cache en un contexto de <a href="/en-US/docs/Web/API/Service_Worker_API">service worker</a> para guardar assets <em>offline</em>.</p> + +<pre class="brush: js">this.addEventListener('install', function(event) { + event.waitUntil( + caches.open('v1').then(function(cache) { + return cache.addAll( + '/sw-test/', + '/sw-test/index.html', + '/sw-test/style.css', + '/sw-test/app.js', + '/sw-test/image-list.js', + '/sw-test/star-wars-logo.jpg', + '/sw-test/gallery/', + '/sw-test/gallery/bountyHunters.jpg', + '/sw-test/gallery/myLittleVader.jpg', + '/sw-test/gallery/snowTroopers.jpg' + ); + }) + ); +});</pre> + +<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('Service Workers', '#self-caches', 'caches')}}</td> + <td>{{Spec2('Service Workers')}}</td> + <td>Definido en un <code>WindowOrWorkerGlobalScope</code> parcial en la última especificación.</td> + </tr> + <tr> + <td>{{SpecName('Service Workers')}}</td> + <td>{{Spec2('Service Workers')}}</td> + <td>Definición inicial.</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidad_de_Navegadores">Compatibilidad de Navegadores</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Característica</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari</th> + </tr> + <tr> + <td>Soporte Básico</td> + <td>40.0</td> + <td>{{CompatGeckoDesktop(42)}}<br> + {{CompatGeckoDesktop(52)}}<sup>[1]</sup></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Característica</th> + <th>Android</th> + <th>Chrome para Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Soporte Básico</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile(42)}}<br> + {{CompatGeckoMobile(52)}}<sup>[1]</sup></td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] las <code>caches</code> se definen ahora en el mixin {{domxref("WindowOrWorkerGlobalScope")}}.</p> + +<h2 id="Ver_también">Ver también</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/ServiceWorker_API">Service Workers</a></li> + <li><a href="/en-US/docs/Web/API/Web_Workers_API">Web Workers</a></li> + <li>{{domxref("CacheStorage")}}</li> + <li>{{domxref("Cache")}}</li> +</ul> |