From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/fr/web/api/clients/claim/index.html | 125 +++++++++++++++++++++++ files/fr/web/api/clients/get/index.html | 115 ++++++++++++++++++++++ files/fr/web/api/clients/index.html | 120 ++++++++++++++++++++++ files/fr/web/api/clients/matchall/index.html | 130 ++++++++++++++++++++++++ files/fr/web/api/clients/openwindow/index.html | 131 +++++++++++++++++++++++++ 5 files changed, 621 insertions(+) create mode 100644 files/fr/web/api/clients/claim/index.html create mode 100644 files/fr/web/api/clients/get/index.html create mode 100644 files/fr/web/api/clients/index.html create mode 100644 files/fr/web/api/clients/matchall/index.html create mode 100644 files/fr/web/api/clients/openwindow/index.html (limited to 'files/fr/web/api/clients') diff --git a/files/fr/web/api/clients/claim/index.html b/files/fr/web/api/clients/claim/index.html new file mode 100644 index 0000000000..4901f018b7 --- /dev/null +++ b/files/fr/web/api/clients/claim/index.html @@ -0,0 +1,125 @@ +--- +title: Clients.claim() +slug: Web/API/Clients/claim +tags: + - API + - Clients + - Méthode + - Reference + - Service Workers + - claim +translation_of: Web/API/Clients/claim +--- +

{{SeeCompatTable}}{{APIRef("Service Worker Clients")}}

+ +

La méthode claim() de l'interface {{domxref("Clients")}} permet à un service worker actif de se définir comme service worker actif de la page client quand le worker et la page sont dans le même scope. Ceci déclenche un évènement {{domxref("ServiceWorkerContainer.oncontrollerchange","oncontrollerchange")}} dans toutes les pages dans la portée du service worker.

+ +

Cette méthode peut être utilisée avec {{domxref("ServiceWorkerGlobalScope.skipWaiting()")}} pour s'assurer que la mise à jour du service worker sous jacent prend effet immédiatement pour et le client courant et tous les autres clients actifs.

+ +

Syntaxe

+ +
ServiceWorkerClients.claim().then(function() {
+  // Faire quelque chose
+});
+
+ +

Paramètres

+ +

None.

+ +

Valeur de retour

+ +

Une Promise.

+ +

Exemple

+ +

L'exemple suivant utilise claim() dans le gestionnaire d'évènement onActivate d'un service worker. Donc la page client chargée dans la même portée n'a pas besoin d'être rechargée avant de pouvoir utiliser le service worker.

+ +
self.addEventListener('install', function(event) {
+  event.waitUntil(self.skipWaiting());
+});
+self.addEventListener('activate', function(event) {
+  event.waitUntil(self.clients.claim());
+});
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationStatutCommentaire
{{SpecName('Service Workers', '#clients', 'Clients')}}{{Spec2('Service Workers')}}Définition initiale. Toujours en cours de développement (voir ticket 414 et ticket 423).
+ +

Compatibilité de navigateurs

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FonctionnalitéChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Support de base{{CompatChrome(42.0)}}{{ CompatGeckoDesktop("44.0") }}{{CompatNo}}24{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitéAndroidFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
Support de base{{CompatUnknown}}{{ CompatGeckoMobile("44.0") }}{{ CompatVersionUnknown }}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}{{CompatUnknown}}
+
+ +

À voir aussi

+ + diff --git a/files/fr/web/api/clients/get/index.html b/files/fr/web/api/clients/get/index.html new file mode 100644 index 0000000000..1b52f54c9c --- /dev/null +++ b/files/fr/web/api/clients/get/index.html @@ -0,0 +1,115 @@ +--- +title: Clients.get() +slug: Web/API/Clients/get +tags: + - API + - Clients + - Méthode + - Reference + - Service Workers + - get +translation_of: Web/API/Clients/get +--- +
{{SeeCompatTable}}{{APIRef("Service Workers API")}}
+ +
La méthode get() de l'interface {{domxref("Clients")}} récupère un service worker client correspondant à un id donné et le retourne dans une {{jsxref("Promise")}}.
+ +
 
+ +

Syntaxe

+ +
self.clients.get(id).then(function(client) {
+  // Faire quelque chose avec le client
+});
+ +

Paramètres

+ +
+
id
+
Une {{domxref("DOMString")}} représentant l'id du client que vous souhaitez récuperer.
+
+ +

Valeur de retour

+ +
+
Une Promise qui se résoud avec un objet {{domxref("Client")}}.
+
+ +

Exemples

+ +
self.clients.get(options).then(function(client) {
+  self.clients.openWindow(client.url);
+});
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationStatutCommentaires
{{SpecName('Service Workers', '#clients-get-method', 'get()')}}{{Spec2('Service Workers')}}Définition initiale
+ +

Compatibilité des navigateurs

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FonctionnalitéChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Support de base{{CompatVersionUnknown}}{{ CompatGeckoDesktop("45.0") }}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitéAndroidAndroid WebviewFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
Support de base{{CompatNo}}{{CompatVersionUnknown}}{{ CompatGeckoMobile("45.0") }}{{ CompatVersionUnknown }}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}{{CompatVersionUnknown}}
+
diff --git a/files/fr/web/api/clients/index.html b/files/fr/web/api/clients/index.html new file mode 100644 index 0000000000..1e53aade96 --- /dev/null +++ b/files/fr/web/api/clients/index.html @@ -0,0 +1,120 @@ +--- +title: Clients +slug: Web/API/Clients +tags: + - API + - Clients + - Experimental + - Interface + - Reference + - ServiceWorker +translation_of: Web/API/Clients +--- +

{{SeeCompatTable}}{{APIRef("Service Workers API")}}

+ +

L'interface Clients de l'API de Service Workers repésente un conteneur de liste d'objets {{domxref("Client")}}.

+ +

Méthodes

+ +
+
{{domxref("Clients.get()")}}
+
Récupère un service worker client correspondant à un id et le retourne dans une {{jsxref("Promise")}}.
+
{{domxref("Clients.matchAll()")}}
+
Récupèere une liste de service worker clients et les retourne dans une {{jsxref("Promise")}}. On inclut un paramètre option pour retourner tous les services worker clients dont l'origine est la même que le service worker d'origine. Si option n'est pas inclut, la méthode retourne seulement les service worker clients controllés par le service worker.
+
{{domxref("Clients.openWindow()")}}
+
Ouvre un service worker {{domxref("Client")}} dans une nouvelle fenêtre de navigation.
+
{{domxref("Clients.claim()")}}
+
Permet à un service worker actif de se définir comme étant le worker actif de la page quand le worker et la page sont dans la même portée.
+
+ +

Exemples

+ +
clients.matchAll(options).then(function(clients) {
+  for(i = 0 ; i < clients.length ; i++) {
+    if(clients[i] === 'index.html') {
+      clients.openWindow(clients[i]);
+      // ou faire quelque chose qui inclut le client concerné
+    }
+  }
+});
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationStatutCommentaire
{{SpecName('Service Workers', '#clients', 'Clients')}}{{Spec2('Service Workers')}}Initial definition
+ +

Compatibilité des navigateurs

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome(40.0)}}{{ CompatGeckoDesktop("44.0") }}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
Basic support{{CompatUnknown}}{{ CompatGeckoMobile("44.0") }}{{ CompatVersionUnknown }}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}{{CompatUnknown}}
+
+ +

À voir aussi :

+ + diff --git a/files/fr/web/api/clients/matchall/index.html b/files/fr/web/api/clients/matchall/index.html new file mode 100644 index 0000000000..6b17e793b9 --- /dev/null +++ b/files/fr/web/api/clients/matchall/index.html @@ -0,0 +1,130 @@ +--- +title: Clients.matchAll() +slug: Web/API/Clients/matchAll +tags: + - API + - Client + - Expérimental(2) + - Méthode + - Référence(2) + - Service Workers +translation_of: Web/API/Clients/matchAll +--- +
{{SeeCompatTable}}{{APIRef("Service Workers API")}}
+ +
La méthode matchAll() de l'interface {{domxref("Clients")}} retourne une Promesse pour une liste de service worker clients. Inclure le paramètre options permet de retourner tous les services worker clients dont l'origine est la même que l'origine du service worker associé. Si options n'est pas inclus, la méthode retourne que le service worker client controllé par le service worker.
+ +
 
+ +

Syntaxe

+ +
ServiceWorkerClients.matchAll(options).then(function(clients) {
+  // faire quelque chose avec la list de clients
+});
+ +

Paramètres

+ +
+
options
+
L'objet option vous permet de définir les options pour l'opération. Les options disponibles sont : +
    +
  • includeUncontrolled: Un {{domxref("Boolean")}} — défini à true, l'opération retournera tous les services worker clients qui sont de la même origine que le service worker courant. Sinon, elle ne retournera que le service worker client controllé par le service worker courant. La valeur par défaut est false.
  • +
  • type: Défini le type de client que vous voulez observer. Les types disponibles sont window, worker, sharedworker, et all. La valeur par défaut est all.
  • +
+
+
+ +

Valeur de retour

+ +
+
Une  Promesse qui se résout avec un tableau d'objets {{domxref("Client")}}.
+
+ +

Exemples

+ +
clients.matchAll(options).then(function(clientList) {
+  for(var i = 0 ; i < clients.length ; i++) {
+    if(clientList[i].url === 'index.html') {
+      clients.openWindow(clientList[i]);
+      // ou faire quelque chose avec le client
+    }
+  }
+});
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationStatutCommentaire
{{SpecName('Service Workers', '#clients', 'Clients')}}{{Spec2('Service Workers')}}Définition initial.
+ +

Compatibilité des navigateurs

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FonctionnalitéChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Support de base{{CompatChrome(40.0)}}[1]{{ CompatGeckoDesktop("44.0") }}[2]{{CompatNo}}{{CompatUnknown}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitéAndroidAndroid WebviewFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
Support de base{{CompatNo}}{{CompatChrome(40.0)}}[1]{{ CompatGeckoMobile("44.0") }}{{ CompatVersionUnknown }}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}{{CompatChrome(40.0)}}
+
+ + diff --git a/files/fr/web/api/clients/openwindow/index.html b/files/fr/web/api/clients/openwindow/index.html new file mode 100644 index 0000000000..906953237a --- /dev/null +++ b/files/fr/web/api/clients/openwindow/index.html @@ -0,0 +1,131 @@ +--- +title: Clients.openWindow() +slug: Web/API/Clients/openWindow +translation_of: Web/API/Clients/openWindow +--- +

{{SeeCompatTable}}{{APIRef("Service Workers API")}}

+ +

La méthode openWindow() de l'interface {{domxref("Clients")}} crée un nouveau niveau de contexte de navigation et charge une URL donnée. Si le script d'origine n'a pas la permission d'ouvrir une popup,   openWindow() lèvera une InvalidAccessError.

+ +

Dans Firefox, une méthode est authorisée d'ouvrir une popup seulement lorsqu'elle est appelée à la suite d'un click sur une notification.

+ +

Syntaxe

+ +
ServiceWorkerClients.openWindow(url).then(function(WindowClient) {
+  // Faire quelque chose avec le WindowClient
+});
+ +

Paramètres

+ +
+
url
+
Une {{domxref("USVString")}} représentant l'URL que le client veut ouvrir dans une nouvelle fenêtre. Généralement, cette valeur doit être une URL de la même  origine que le script d'origine.
+
+ +

Valeur de retour

+ +
+
Une {{jsxref("Promise")}} qui résoud un objet {{domxref("WindowClient")}} si l'URL est de la même origine que le service worker, et {{Glossary("null", "null value")}} sinon.
+
+ +

Exemples

+ +
// Quand l'utilisateur click sur une notification, focus sur la fenêtre si elle existe,
+// ou ouvre en une autre.
+onotificationclick = function(event) {
+  var found = false;
+  clients.matchAll().then(function(clients) {
+    for (i = 0; i < clients.length; i++) {
+      if (clients[i].url === event.data.url) {
+        // La fenêtre existe, focus dessus.
+        found = true;
+        clients[i].focus();
+        break;
+      }
+    }
+    if (!found) {
+      // Crée une nouvelle fenêtre
+      clients.openWindow(event.data.url).then(function(windowClient) {
+        // Faire quelque chose avec le WindowClient
+      });
+    }
+  });
+};
+
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationStatutCommentaire
{{SpecName('Service Workers', '#clients', 'Clients')}}{{Spec2('Service Workers')}}Définition initiale
+ +

Compatibilité des navigateurs

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FonctionnalitéChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Support de base{{CompatChrome(42.0)}} [1]{{ CompatGeckoDesktop("45.0") }}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitéAndroidAndroid WebviewFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
Support de base{{CompatNo}}{{CompatNo}}{{ CompatGeckoMobile("45.0") }}{{ CompatVersionUnknown }}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}{{CompatChrome(40.0)}} [1]
+
+ + -- cgit v1.2.3-54-g00ecf