diff options
Diffstat (limited to 'files/fr/web/api/windowclient')
-rw-r--r-- | files/fr/web/api/windowclient/focus/index.html | 126 | ||||
-rw-r--r-- | files/fr/web/api/windowclient/focused/index.html | 113 | ||||
-rw-r--r-- | files/fr/web/api/windowclient/index.html | 165 | ||||
-rw-r--r-- | files/fr/web/api/windowclient/navigate/index.html | 109 | ||||
-rw-r--r-- | files/fr/web/api/windowclient/visibilitystate/index.html | 107 |
5 files changed, 620 insertions, 0 deletions
diff --git a/files/fr/web/api/windowclient/focus/index.html b/files/fr/web/api/windowclient/focus/index.html new file mode 100644 index 0000000000..941c9b4bb6 --- /dev/null +++ b/files/fr/web/api/windowclient/focus/index.html @@ -0,0 +1,126 @@ +--- +title: WindowClient.focus() +slug: Web/API/WindowClient/focus +tags: + - API + - Client + - Experimental + - Focus + - Method + - Reference + - Service Workers + - WindowClient +translation_of: Web/API/WindowClient/focus +--- +<p>{{SeeCompatTable}}{{APIRef("Service Workers API")}}</p> + +<p>La méthode <strong><code>focus()</code></strong> de l'interface {{domxref("WindowClient")}} focus le client en cours et retourne une {{jsxref("Promise")}} qui est résolue vers le<span> {{domxref("WindowClient")}} existant.</span></p> + +<h2 id="Syntaxe">Syntaxe</h2> + +<pre class="syntaxbox">Client.focus().then(function(WindowClient) { + // utilisez le WindowClient une fois qu'il est focus +});</pre> + +<h3 id="Paramètres">Paramètres</h3> + +<p>Nil.</p> + +<h3 id="Valeur_de_retour">Valeur de retour</h3> + +<p>Une {{jsxref("Promise")}} qui est résolue vers le {{domxref("WindowClient")}} existant.</p> + +<h2 id="Exemple">Exemple</h2> + +<pre class="brush: js">self.addEventListener('notificationclick', function(event) { + console.log('On notification click: ', event.notification.tag); + event.notification.close(); + +<code> // Vérifie si le client en cours est ouvert et + // le focus le cas échéant</code> + event.waitUntil(clients.matchAll({ + type: "window" + }).then(function(clientList) { + for (var i = 0; i < clientList.length; i++) { + var client = clientList[i]; + if (client.url == '/' && 'focus' in client) + return client.focus(); + } + if (clients.openWindow) + return clients.openWindow('/'); + })); +});</pre> + +<h2 id="Spécifications">Spécifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spécification</th> + <th scope="col">État</th> + <th scope="col">Commentaires</th> + </tr> + <tr> + <td>{{SpecName('Service Workers', '#client-focus-method', 'focus()')}}</td> + <td>{{Spec2('Service Workers')}}</td> + <td>Définition initiale..</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Fonctionnalité</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Support simple</td> + <td>{{CompatChrome(42.0)}}</td> + <td>{{ CompatGeckoDesktop("44.0") }}<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>Fonctionnalité</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Support simple</td> + <td>{{CompatUnknown}}</td> + <td>{{ CompatGeckoMobile("44.0") }}</td> + <td>{{ CompatVersionUnknown }}</td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatChrome(42.0)}}</td> + </tr> + </tbody> +</table> +</div> + +<p><br> + [1] Les Service workers (et <a href="https://developer.mozilla.org/en-US/docs/Web/API/Push_API">Push</a>) sont désactivés dans <a href="https://www.mozilla.org/en-US/firefox/organizations/">Firefox 45 Extended Support Release</a> (ESR.)</p> diff --git a/files/fr/web/api/windowclient/focused/index.html b/files/fr/web/api/windowclient/focused/index.html new file mode 100644 index 0000000000..7b4db1157f --- /dev/null +++ b/files/fr/web/api/windowclient/focused/index.html @@ -0,0 +1,113 @@ +--- +title: WindowClient.focused +slug: Web/API/WindowClient/focused +translation_of: Web/API/WindowClient/focused +--- +<div>{{SeeCompatTable}}{{APIRef("Service Workers API")}}</div> + +<p>La propriété <strong><code>focused</code></strong> , en lecture seule de l'interface {{domxref("WindowClient")}} , est un {{domxref("Boolean")}} qui indique si client actuel a le focus .</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox">myFocused = WindowClient.focused;</pre> + +<h3 id="Value">Value</h3> + +<p>A {{domxref("Boolean")}}.</p> + +<h2 id="Example">Example</h2> + +<pre class="brush: js">self.addEventListener('notificationclick', function(event) { + console.log('On notification click: ', event.notification.tag); + event.notification.close(); + + // This looks to see if the current is already open and + // focuses if it is + event.waitUntil(clients.matchAll({ + type: "window" + }).then(function(clientList) { + for (var i = 0; i < clientList.length; i++) { + var client = clientList[i]; + if (client.url == '/' && 'focus' in client) { + if(!client.focused) + return client.focus(); + } + } + } + if (clients.openWindow) + return clients.openWindow('/'); + })); +});</pre> + +<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('Service Workers', '#window-client-interface', 'WindowClient')}}</td> + <td>{{Spec2('Service Workers')}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilité_des_Navigateurs">Compatibilité des Navigateurs</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(42.0)}}</td> + <td>{{ CompatGeckoDesktop("44.0") }}<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>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatUnknown}}</td> + <td>{{ CompatGeckoMobile("44.0") }}</td> + <td>{{ CompatVersionUnknown }}</td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatChrome(42.0)}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Service workers (and <a href="/en-US/docs/Web/API/Push_API">Push</a>) have been disabled in the <a href="https://www.mozilla.org/en-US/firefox/organizations/">Firefox 45 and 52 Extended Support Releases</a> (ESR.)</p> diff --git a/files/fr/web/api/windowclient/index.html b/files/fr/web/api/windowclient/index.html new file mode 100644 index 0000000000..0bcb278c98 --- /dev/null +++ b/files/fr/web/api/windowclient/index.html @@ -0,0 +1,165 @@ +--- +title: WindowClient +slug: Web/API/WindowClient +tags: + - API + - Client + - Experimental + - Interface + - Reference + - Service Workers + - ServiceWorker + - WindowClient +translation_of: Web/API/WindowClient +--- +<p>{{SeeCompatTable}}{{APIRef("Service Workers API")}}</p> + +<p>L'interface <code>WindowClient</code> de l'<a href="/en-US/docs/Web/API/ServiceWorker_API">API ServiceWorker</a> représente la portée d'un client service worker lorsque celui-ci existe en tant que document dans un contexte navigateur, controlé par un worker actif. Le client sélectionne et utilise un service worker pour son propre chargement et celui de ses sous-ressources.</p> + +<h2 id="Méthodes">Méthodes</h2> + +<p><em><code>WindowClient</code> hérite certaines méthodes de son parent, {{domxref("Client")}}.</em></p> + +<dl> + <dt>{{domxref("WindowClient.focus()")}}</dt> + <dd>Assigne le focus au client en cours.</dd> + <dt>{{domxref("WindowClient.navigate()")}}</dt> + <dd>Charge l'url spécifiée dans la page en cours.</dd> +</dl> + +<h2 id="Propriétés">Propriétés</h2> + +<p><em><code>WindowClient</code> hérite certaines propriétés de son parent, {{domxref("Client")}}.</em></p> + +<dl> + <dt>{{domxref("WindowClient.focused")}} {{readonlyInline}}</dt> + <dd>Un booléen qui indique si oui ou non le client en cours est focus.</dd> + <dt>{{domxref("WindowClient.visibilityState")}} {{readonlyInline}}</dt> + <dd>Indique la visibilité du client en cours. Peut prendre les valeures <code>hidden</code>, <code>visible</code>, <code>prerender</code>, ou <code>unloaded</code>.</dd> +</dl> + +<h2 id="Exemple">Exemple</h2> + +<pre class="brush: js">self.addEventListener('notificationclick', function(event) { + console.log('On notification click: ', event.notification.tag); + event.notification.close(); + + // Vérifie si le client en cours est ouvert et + // le focus le cas échéant + event.waitUntil(clients.matchAll({ + type: "window" + }).then(function(clientList) { + for (var i = 0; i < clientList.length; i++) { + var client = clientList[i]; + if (client.url == '/' && 'focus' in client) + return client.focus(); + } + if (clients.openWindow) + return clients.openWindow('/'); + })); +});</pre> + +<h2 id="Spécifications">Spécifications</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Spécification</th> + <th scope="col">État</th> + <th scope="col">Commentaires</th> + </tr> + <tr> + <td>{{SpecName('Service Workers', '#window-client-interface', 'WindowClient')}}</td> + <td>{{Spec2('Service Workers')}}</td> + <td>Définition initiale.</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilité_des_navigateurs">Compatibilité des navigateurs</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Fonctionnalité</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Support simple</td> + <td>{{CompatChrome(42.0)}}</td> + <td>{{ CompatGeckoDesktop("44.0") }}<sup>[1]</sup></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + </tr> + <tr> + <td><code>navigate()</code></td> + <td>{{CompatChrome(49.0)}}</td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Fonctionnalité</th> + <th>Android</th> + <th>Android Webview</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Support simple</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{ CompatGeckoMobile("44.0") }}</td> + <td>{{ CompatVersionUnknown }}</td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatChrome(42.0)}}</td> + </tr> + <tr> + <td><code>navigate()</code></td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td> </td> + <td>{{CompatChrome(49.0)}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Les Service workers (et <a href="/en-US/docs/Web/API/Push_API">Push</a>) sont désactivés dans <a href="https://www.mozilla.org/en-US/firefox/organizations/">Firefox 45 Extended Support Release</a> (ESR.)</p> + +<h2 id="Voir_aussi">Voir aussi</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/ServiceWorker_API/Using_Service_Workers">Using Service Workers</a></li> + <li><a href="https://github.com/mdn/sw-test">Service workers basic code example</a></li> + <li><a href="https://jakearchibald.github.io/isserviceworkerready/">Is ServiceWorker ready?</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promises</a></li> + <li><a href="/en-US/docs/Web/Guide/Performance/Using_web_workers">Using web workers</a></li> + <li><a href="/en-US/docs/Web/API/Channel_Messaging_API">Channel Messaging API</a></li> +</ul> diff --git a/files/fr/web/api/windowclient/navigate/index.html b/files/fr/web/api/windowclient/navigate/index.html new file mode 100644 index 0000000000..0cc4c15659 --- /dev/null +++ b/files/fr/web/api/windowclient/navigate/index.html @@ -0,0 +1,109 @@ +--- +title: WindowClient.navigate() +slug: Web/API/WindowClient/navigate +tags: + - API + - Client + - Expérimentale + - Method + - Navigate + - Reference + - Service Workers + - WindowClient +translation_of: Web/API/WindowClient/navigate +--- +<p>{{SeeCompatTable}}{{APIRef("Service Workers API")}}</p> + +<p>La méthode <strong><code>navigate()</code></strong> de l'interface {{domxref("WindowClient")}} <span id="noHighlight_0.005279926980020444">charge une URL spécifiée dans une page de client contrôlée, puis retourne une</span> {{jsxref("Promise")}} <span id="noHighlight_0.005279926980020444">qui devra être analysée p</span>ar {{domxref("WindowClient")}} (le demandeur).</p> + +<h2 id="Syntaxe">Syntaxe</h2> + +<pre class="syntaxbox"><em>WindowClient</em>.navigate(<em>url</em>).then(function(<em>WindowClient</em>) { + // do something with your WindowClient after navigation +});</pre> + +<h3 id="Paramètres">Paramètres</h3> + +<dl> + <dt><code>url</code></dt> + <dd><span id="noHighlight_0.8092575892867941">L'emplacement pour naviguer vers (url est une string)</span> .</dd> +</dl> + +<h3 id="Retour">Retour</h3> + +<p>Une {{jsxref("Promise")}} qui sera analysée par le demandeur {{domxref("WindowClient")}} (fonctionnement asynchrone : je te promet de faire, mais je suis pas sûr, à toi de vérifier) .</p> + +<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('Service Workers', '#client-navigate-method', 'navigate()')}}</td> + <td>{{Spec2('Service Workers')}}</td> + <td>définition initiale</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilité_des_Navigateurs">Compatibilité des Navigateurs</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(49.0)}}</td> + <td>{{CompatGeckoDesktop(50)}}<sup>[1]</sup></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Android Webview</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatGeckoMobile(50)}}<sup>[1]</sup></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatChrome(49.0)}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Service workers (and <a href="/en-US/docs/Web/API/Push_API">Push</a>) ont été désactivés dans <a href="https://www.mozilla.org/en-US/firefox/organizations/">Firefox 52 Extended Support Release</a> (ESR.)</p> diff --git a/files/fr/web/api/windowclient/visibilitystate/index.html b/files/fr/web/api/windowclient/visibilitystate/index.html new file mode 100644 index 0000000000..83791f1f9b --- /dev/null +++ b/files/fr/web/api/windowclient/visibilitystate/index.html @@ -0,0 +1,107 @@ +--- +title: WindowClient.visibilityState +slug: Web/API/WindowClient/visibilityState +translation_of: Web/API/WindowClient/visibilityState +--- +<p><span style="line-height: 19.0909080505371px;">{{SeeCompatTable}}{{APIRef("Service Workers API")}}</span></p> + +<p><span style="line-height: 19.0909080505371px;">La propriété <strong><code>visibilityState</code></strong>, en lecture seule de l'interface {{domxref("WindowClient")}} indique la visibilité du client courant</span>. La valeur pourra être : <code>hidden</code>, <code>visible</code>, <code>prerender</code>, or <code>unloaded</code>.</p> + +<h2 id="Syntaxe">Syntaxe</h2> + +<pre class="brush: js">myVisState = WindowClient.visibilityState;</pre> + +<h3 id="Value">Value</h3> + +<p>une {{domxref("DOMString")}}.</p> + +<h2 id="Example">Example</h2> + +<pre class="brush: js"> event.waitUntil(clients.matchAll({ + type: "window" + }).then(function(clientList) { + for (var i = 0; i < clientList.length; i++) { + var client = clientList[i]; + if (client.url == '/' && 'focus' in client) { + if(visibilityState === 'hidden') + return client.focus(); + } + } + } + if (clients.openWindow) + return clients.openWindow('/'); + })); +});</pre> + +<h2 id="Spécifications" style="line-height: 30px; font-size: 2.14285714285714rem;">Spécifications</h2> + +<table class="standard-table" style="line-height: 19.0909080505371px;"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('Service Workers', '#window-client-interface', 'WindowClient')}}</td> + <td>{{Spec2('Service Workers')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilité_des_Navigateurs">Compatibilité des Navigateurs</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(42.0)}}</td> + <td>{{ CompatGeckoDesktop("44.0") }}<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>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatUnknown}}</td> + <td>{{ CompatGeckoMobile("44.0") }}</td> + <td>{{ CompatVersionUnknown }}</td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatChrome(42.0)}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Service workers (and <a href="/en-US/docs/Web/API/Push_API">Push</a>) have been disabled in the <a href="https://www.mozilla.org/en-US/firefox/organizations/">Firefox 45 and 52 Extended Support Releases</a> (ESR.)</p> |