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/windowclient/focus/index.html | 126 ++++++++++++++++ files/fr/web/api/windowclient/focused/index.html | 113 ++++++++++++++ files/fr/web/api/windowclient/index.html | 165 +++++++++++++++++++++ files/fr/web/api/windowclient/navigate/index.html | 109 ++++++++++++++ .../api/windowclient/visibilitystate/index.html | 107 +++++++++++++ 5 files changed, 620 insertions(+) create mode 100644 files/fr/web/api/windowclient/focus/index.html create mode 100644 files/fr/web/api/windowclient/focused/index.html create mode 100644 files/fr/web/api/windowclient/index.html create mode 100644 files/fr/web/api/windowclient/navigate/index.html create mode 100644 files/fr/web/api/windowclient/visibilitystate/index.html (limited to 'files/fr/web/api/windowclient') 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 +--- +

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

+ +

La méthode focus() de l'interface {{domxref("WindowClient")}} focus le client en cours et retourne une {{jsxref("Promise")}} qui est résolue vers le {{domxref("WindowClient")}} existant.

+ +

Syntaxe

+ +
Client.focus().then(function(WindowClient) {
+  // utilisez le WindowClient une fois qu'il est focus
+});
+ +

Paramètres

+ +

Nil.

+ +

Valeur de retour

+ +

Une {{jsxref("Promise")}} qui est résolue vers le {{domxref("WindowClient")}} existant.

+ +

Exemple

+ +
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('/');
+  }));
+});
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('Service Workers', '#client-focus-method', 'focus()')}}{{Spec2('Service Workers')}}Définition initiale..
+ +

Compatibilité des navigateurs

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


+ [1] Les Service workers (et Push) sont désactivés dans Firefox 45 Extended Support Release (ESR.)

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 +--- +
{{SeeCompatTable}}{{APIRef("Service Workers API")}}
+ +

La propriété focused , en lecture seule de l'interface  {{domxref("WindowClient")}} , est un {{domxref("Boolean")}} qui indique si client actuel a le focus .

+ +

Syntax

+ +
myFocused = WindowClient.focused;
+ +

Value

+ +

A {{domxref("Boolean")}}.

+ +

Example

+ +
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('/');
+  }));
+});
+ +

Specifications

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('Service Workers', '#window-client-interface', 'WindowClient')}}{{Spec2('Service Workers')}}Initial definition
+ +

Compatibilité des Navigateurs

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

[1] Service workers (and Push) have been disabled in the Firefox 45 and 52 Extended Support Releases (ESR.)

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 +--- +

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

+ +

L'interface WindowClient de l'API ServiceWorker 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.

+ +

Méthodes

+ +

WindowClient hérite certaines méthodes de son parent, {{domxref("Client")}}.

+ +
+
{{domxref("WindowClient.focus()")}}
+
Assigne le focus au client en cours.
+
{{domxref("WindowClient.navigate()")}}
+
Charge l'url spécifiée dans la page en cours.
+
+ +

Propriétés

+ +

WindowClient hérite certaines propriétés de son parent, {{domxref("Client")}}.

+ +
+
{{domxref("WindowClient.focused")}} {{readonlyInline}}
+
Un booléen qui indique si oui ou non le client en cours est focus.
+
{{domxref("WindowClient.visibilityState")}} {{readonlyInline}}
+
Indique la visibilité du client en cours. Peut prendre les valeures hidden, visible, prerender, ou unloaded.
+
+ +

Exemple

+ +
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('/');
+  }));
+});
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('Service Workers', '#window-client-interface', 'WindowClient')}}{{Spec2('Service Workers')}}Définition initiale.
+ +

Compatibilité des navigateurs

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitéChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Support simple{{CompatChrome(42.0)}}{{ CompatGeckoDesktop("44.0") }}[1]{{CompatNo}}{{CompatUnknown}}{{CompatNo}}
navigate(){{CompatChrome(49.0)}}    
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitéAndroidAndroid WebviewFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
Support simple{{CompatNo}}{{CompatNo}}{{ CompatGeckoMobile("44.0") }}{{ CompatVersionUnknown }}{{CompatNo}}{{CompatUnknown}}{{CompatNo}}{{CompatChrome(42.0)}}
navigate(){{CompatNo}}{{CompatNo}}     {{CompatChrome(49.0)}}
+
+ +

[1] Les Service workers (et Push) sont désactivés dans Firefox 45 Extended Support Release (ESR.)

+ +

Voir aussi

+ + 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 +--- +

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

+ +

La méthode navigate() de l'interface  {{domxref("WindowClient")}} charge une URL spécifiée dans une page de client contrôlée, puis retourne une  {{jsxref("Promise")}}  qui devra être analysée par  {{domxref("WindowClient")}} (le demandeur).

+ +

Syntaxe

+ +
WindowClient.navigate(url).then(function(WindowClient) {
+  // do something with your WindowClient after navigation
+});
+ +

Paramètres

+ +
+
url
+
L'emplacement pour naviguer vers (url est une string) .
+
+ +

Retour

+ +

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) .

+ +

Spécifications

+ + + + + + + + + + + + + + +
SpécificationStatutCommentaire
{{SpecName('Service Workers', '#client-navigate-method', 'navigate()')}}{{Spec2('Service Workers')}}définition initiale
+ +

Compatibilité des Navigateurs

+ +
{{CompatibilityTable}}
+ +
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support{{CompatChrome(49.0)}}{{CompatGeckoDesktop(50)}}[1]{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidAndroid WebviewFirefox Mobile (Gecko)Firefox OSIE MobileOpera MobileSafari MobileChrome for Android
Basic support{{CompatNo}}{{CompatNo}}{{CompatGeckoMobile(50)}}[1]{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}{{CompatChrome(49.0)}}
+
+ +

[1] Service workers (and Push) ont été  désactivés dans  Firefox 52 Extended Support Release (ESR.)

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 +--- +

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

+ +

La propriété visibilityState,  en lecture seule de l'interface {{domxref("WindowClient")}} indique la visibilité du client courant. La valeur pourra être :  hidden, visible, prerender, or unloaded.

+ +

Syntaxe

+ +
myVisState = WindowClient.visibilityState;
+ +

Value

+ +

une  {{domxref("DOMString")}}.

+ +

Example

+ +
  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('/');
+  }));
+});
+ +

Spécifications

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('Service Workers', '#window-client-interface', 'WindowClient')}}{{Spec2('Service Workers')}}Initial definition.
+ +

Compatibilité des Navigateurs

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

[1] Service workers (and Push) have been disabled in the Firefox 45 and 52 Extended Support Releases (ESR.)

-- cgit v1.2.3-54-g00ecf