diff options
Diffstat (limited to 'files/fr/web/api/cachestorage/has/index.md')
-rw-r--r-- | files/fr/web/api/cachestorage/has/index.md | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/files/fr/web/api/cachestorage/has/index.md b/files/fr/web/api/cachestorage/has/index.md index ae799a0f03..380f7678e8 100644 --- a/files/fr/web/api/cachestorage/has/index.md +++ b/files/fr/web/api/cachestorage/has/index.md @@ -14,7 +14,7 @@ translation_of: Web/API/CacheStorage/has --- {{APIRef("Service Workers API")}}{{SeeCompatTable}} -La méthode **`has()`** de l'interface {{domxref("CacheStorage")}} retourne une {{jsxref("Promise", "Promesse")}} qui renvoie `true` si un objet {{domxref("Cache")}} est égal au `cacheName`. +La méthode **`has()`** de l'interface {{domxref("CacheStorage")}} retourne une {{jsxref("Promise", "Promesse")}} qui renvoie `true` si un objet {{domxref("Cache")}} est égal au `cacheName`. Vous pouvez accéder à `CacheStorage` via la propriété globale {{domxref("WindowOrWorkerGlobalScope.caches", "caches")}}. @@ -27,23 +27,23 @@ Vous pouvez accéder à `CacheStorage` via la propriété globale {{domxref("Win ### Paramètres - cacheName - - : Un {{domxref("DOMString")}} représentant le nom de l'objet {{domxref("Cache")}} que vous cherchez dans le {{domxref("CacheStorage")}}. + - : Un {{domxref("DOMString")}} représentant le nom de l'objet {{domxref("Cache")}} que vous cherchez dans le {{domxref("CacheStorage")}}. ### Retour -Une {{jsxref("Promise", "Promesse")}} qui renvoie `true` si le cache existe. +Une {{jsxref("Promise", "Promesse")}} qui renvoie `true` si le cache existe. ## Exemples -L'exemple suivant vérifie qu'un cache nommé 'v1' exists. Si c'est le cas, nous lui ajoutons une liste d'assets. Si non (la promesse `has()` est rejetée) alors nous exécutons une sorte d'initialisation du cache. +L'exemple suivant vérifie qu'un cache nommé 'v1' exists. Si c'est le cas, nous lui ajoutons une liste d'assets. Si non (la promesse `has()` est rejetée) alors nous exécutons une sorte d'initialisation du cache. ```js caches.has('v1').then(function() { caches.open('v1').then(function(cache) { - return cache.addAll(myAssets); + return cache.addAll(myAssets); }); }).catch(function() { - someCacheSetupfunction(); + someCacheSetupfunction(); });; ``` @@ -59,6 +59,6 @@ caches.has('v1').then(function() { ## Voir aussi -- [Utiliser les Service Workers](/fr/docs/Web/API/Service_Worker_API/Using_Service_Workers) +- [Utiliser les Service Workers](/fr/docs/Web/API/Service_Worker_API/Using_Service_Workers) - {{domxref("Cache")}} - {{domxref("WorkerGlobalScope.caches")}} |