aboutsummaryrefslogtreecommitdiff
path: root/files/fr/mozilla/add-ons/webextensions/api/browsingdata/removedownloads/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/fr/mozilla/add-ons/webextensions/api/browsingdata/removedownloads/index.html')
-rw-r--r--files/fr/mozilla/add-ons/webextensions/api/browsingdata/removedownloads/index.html46
1 files changed, 23 insertions, 23 deletions
diff --git a/files/fr/mozilla/add-ons/webextensions/api/browsingdata/removedownloads/index.html b/files/fr/mozilla/add-ons/webextensions/api/browsingdata/removedownloads/index.html
index f31bbf0e04..625cb99a06 100644
--- a/files/fr/mozilla/add-ons/webextensions/api/browsingdata/removedownloads/index.html
+++ b/files/fr/mozilla/add-ons/webextensions/api/browsingdata/removedownloads/index.html
@@ -27,7 +27,7 @@ translation_of: Mozilla/Add-ons/WebExtensions/API/browsingData/removeDownloads
<h2 id="Syntaxe">Syntaxe</h2>
-<pre class="syntaxbox brush:js">var removing = browser.browsingData.removeDownloads(
+<pre class="brush: js">var removing = browser.browsingData.removeDownloads(
removalOptions // RemovalOptions object
)
</pre>
@@ -51,40 +51,40 @@ translation_of: Mozilla/Add-ons/WebExtensions/API/browsingData/removeDownloads
<p>Supprime les enregistrements d'objets téléchargés la semaine dernière :</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">function</span> <span class="function token">onRemoved</span><span class="punctuation token">(</span><span class="punctuation token">)</span> <span class="punctuation token">{</span>
- console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span><span class="string token">"removed"</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="punctuation token">}</span>
+<pre class="brush: js">function onRemoved() {
+ console.log("removed");
+}
-<span class="keyword token">function</span> <span class="function token">onError</span><span class="punctuation token">(</span>error<span class="punctuation token">)</span> <span class="punctuation token">{</span>
- console<span class="punctuation token">.</span><span class="function token">error</span><span class="punctuation token">(</span>error<span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="punctuation token">}</span>
+function onError(error) {
+ console.error(error);
+}
-<span class="keyword token">function</span> <span class="function token">weekInMilliseconds</span><span class="punctuation token">(</span><span class="punctuation token">)</span> <span class="punctuation token">{</span>
- <span class="keyword token">return</span> <span class="number token">1000</span> <span class="operator token">*</span> <span class="number token">60</span> <span class="operator token">*</span> <span class="number token">60</span> <span class="operator token">*</span> <span class="number token">24</span> <span class="operator token">*</span> <span class="number token">7</span><span class="punctuation token">;</span>
-<span class="punctuation token">}</span>
+function weekInMilliseconds() {
+ return 1000 * 60 * 60 * 24 * 7;
+}
-<span class="keyword token">var</span> oneWeekAgo <span class="operator token">=</span> <span class="punctuation token">(</span><span class="keyword token">new</span> <span class="class-name token">Date</span><span class="punctuation token">(</span><span class="punctuation token">)</span><span class="punctuation token">)</span><span class="punctuation token">.</span><span class="function token">getTime</span><span class="punctuation token">(</span><span class="punctuation token">)</span> <span class="operator token">-</span> <span class="function token">weekInMilliseconds</span><span class="punctuation token">(</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
+var oneWeekAgo = (new Date()).getTime() - weekInMilliseconds();
-browser<span class="punctuation token">.</span>browsingData<span class="punctuation token">.</span><span class="function token">removeDownloads</span><span class="punctuation token">(</span>
- <span class="punctuation token">{</span>since<span class="punctuation token">:</span> oneWeekAgo<span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">.</span>
-<span class="function token">then</span><span class="punctuation token">(</span>onRemoved<span class="punctuation token">,</span> onError<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre>
+browser.browsingData.removeDownloads(
+ {since: oneWeekAgo}).
+then(onRemoved, onError);</pre>
<p>Supprime tous les enregistrements d'objets téléchargés :</p>
-<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">function</span> <span class="function token">onRemoved</span><span class="punctuation token">(</span><span class="punctuation token">)</span> <span class="punctuation token">{</span>
- console<span class="punctuation token">.</span><span class="function token">log</span><span class="punctuation token">(</span><span class="string token">"removed"</span><span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="punctuation token">}</span>
+<pre class="brush: js">function onRemoved() {
+ console.log("removed");
+}
-<span class="keyword token">function</span> <span class="function token">onError</span><span class="punctuation token">(</span>error<span class="punctuation token">)</span> <span class="punctuation token">{</span>
- console<span class="punctuation token">.</span><span class="function token">error</span><span class="punctuation token">(</span>error<span class="punctuation token">)</span><span class="punctuation token">;</span>
-<span class="punctuation token">}</span>
+function onError(error) {
+ console.error(error);
+}
-browser<span class="punctuation token">.</span>browsingData<span class="punctuation token">.</span><span class="function token">removeDownloads</span><span class="punctuation token">({</span><span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">.</span>
-<span class="function token">then</span><span class="punctuation token">(</span>onRemoved<span class="punctuation token">,</span> onError<span class="punctuation token">)</span><span class="punctuation token">;</span></code></pre>
+browser.browsingData.removeDownloads({}).
+then(onRemoved, onError);</pre>
<p>{{WebExtExamples}}</p>
-<div class="note"><strong>Remerciements :</strong>
+<div class="note"><p><strong>Note :</strong></p>
<p>Cette API est basée sur l'API Chromium <a href="https://developer.chrome.com/extensions/browsingData"><code>chrome.browsingData</code></a>.</p>