aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/api/storagemanager/persisted/index.html
blob: 35fcfa12c2bae79e000890790a3b595c79170fe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
title: StorageManager.persisted()
slug: Web/API/StorageManager/persisted
translation_of: Web/API/StorageManager/persisted
---
<p>{{securecontext_header}}{{APIRef("Storage")}}{{SeeCompatTable}}</p>

<p>La propriété <strong><code>persisted</code></strong> de l’interface {{domxref("StorageManager")}} renvoie une {{jsxref('Promise')}} qui se résoud en <code>true</code> si le mode de boîte est est persistant pour le stockage de votre site.</p>

<h2 id="Syntaxe">Syntaxe</h2>

<pre class="syntaxbox">navigator.storage.persisted().then(function(persistent) { ... })</pre>

<h3 id="Paramètres">Paramètres</h3>

<p>Aucun.</p>

<h3 id="Valeur_de_retour">Valeur de retour</h3>

<p>Une {{jsxref('Promise')}} qui se résoud en un {{jsxref('Boolean')}}.</p>

<h2 id="Example">Example</h2>

<pre class="brush: js"><code>if (navigator.storage &amp;&amp; navigator.storage.persist)
  navigator.storage.persisted().then(function(persistent) {
    if (persistent)
      console.log("Le stockage ne sera pas nettoyé sauf en cas d’action humaine explicite");
    else
      console.log("Le stockage peut être nettoyé par l’UA en cas de pression de stockage.");
  });</code></pre>

<h2 id="Spécifications">Spécifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Spécification</th>
   <th scope="col">Statut</th>
   <th scope="col">Commentaire</th>
  </tr>
  <tr>
   <td>{{SpecName('Storage','#dom-storagemanager-persisted','persisted')}}</td>
   <td>{{Spec2('Storage')}}</td>
   <td>Définition initiale.</td>
  </tr>
 </tbody>
</table>

<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2>

<p>{{Compat("api.StorageManager.persisted")}}</p>