diff options
author | julieng <julien.gattelier@gmail.com> | 2021-10-02 17:20:24 +0200 |
---|---|---|
committer | SphinxKnight <SphinxKnight@users.noreply.github.com> | 2021-10-02 17:30:20 +0200 |
commit | 1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde (patch) | |
tree | 30a56efd3eff3a01bd1611e1840fdbbfacf544a4 /files/fr/web/api/sharedworkerglobalscope | |
parent | c05efa8d7ae464235cf83d7c0956e42dc6974103 (diff) | |
download | translated-content-1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde.tar.gz translated-content-1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde.tar.bz2 translated-content-1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde.zip |
convert content to md
Diffstat (limited to 'files/fr/web/api/sharedworkerglobalscope')
3 files changed, 129 insertions, 175 deletions
diff --git a/files/fr/web/api/sharedworkerglobalscope/applicationcache/index.md b/files/fr/web/api/sharedworkerglobalscope/applicationcache/index.md index 7440932b75..c04e93531d 100644 --- a/files/fr/web/api/sharedworkerglobalscope/applicationcache/index.md +++ b/files/fr/web/api/sharedworkerglobalscope/applicationcache/index.md @@ -3,36 +3,34 @@ title: SharedWorkerGlobalScope.applicationCache slug: Web/API/SharedWorkerGlobalScope/applicationCache translation_of: Web/API/SharedWorkerGlobalScope/applicationCache --- -<div>{{APIRef("Web Workers API")}}</div> +{{APIRef("Web Workers API")}} -<div class="warning"> -<p><strong>Attention :</strong> Application Cache est déprécié depuis Firefox 44, et ne sera plus disponible dans des contextes non sécurisés avant Firefox 60 ({{bug(1354175)}}, currently uniquement sur les versions Nightly/Beta). Ne pas utiliser cette fonctionnalité sur des sites web en production, utilisez plutôt les <a href="/fr/docs/Web/API/Service_Worker_API">services workers.</a></p> -</div> +> **Attention :** Application Cache est déprécié depuis Firefox 44, et ne sera plus disponible dans des contextes non sécurisés avant Firefox 60 ({{bug(1354175)}}, currently uniquement sur les versions Nightly/Beta). Ne pas utiliser cette fonctionnalité sur des sites web en production, utilisez plutôt les [services workers.](/fr/docs/Web/API/Service_Worker_API) -<p>La propriété en lecture seule <code><strong>applicationCache</strong></code> de l'interface {{domxref("SharedWorkerGlobalScope")}} retourne l'objet {{domxref("ApplicationCache")}} pour le <em>worker</em> (voir <a href="/fr/docs/Web/HTML/Using_the_application_cache">Utiliser le cache d'application</a>).</p> +La propriété en lecture seule **`applicationCache`** de l'interface {{domxref("SharedWorkerGlobalScope")}} retourne l'objet {{domxref("ApplicationCache")}} pour le _worker_ (voir [Utiliser le cache d'application](/fr/docs/Web/HTML/Using_the_application_cache)). -<h2 id="Syntaxe">Syntaxe</h2> +## Syntaxe -<pre class="brush: js">var nameObj = self.applicationCache;</pre> +```js +var nameObj = self.applicationCache; +``` -<h3 id="valeur">valeur</h3> +### valeur -<p>Un {{domxref("ApplicationCache")}}.</p> +Un {{domxref("ApplicationCache")}}. -<h2 id="Exemple">Exemple</h2> +## Exemple -<p>Si un <em>worker</em> partagé a un AppCache, vous pouvez récupérer une référence en utilisant à l'intérieur d'un <em>worker</em> partagé:</p> +Si un _worker_ partagé a un AppCache, vous pouvez récupérer une référence en utilisant à l'intérieur d'un _worker_ partagé: -<pre class="brush: js">self.applicationCache</pre> +```js +self.applicationCache +``` -<h2 id="Browser_Compatibility">Compatibilité des navigateurs</h2> +## Compatibilité des navigateurs +{{Compat("api.SharedWorkerGlobalScope.applicationCache")}} +## Voir aussi -<p>{{Compat("api.SharedWorkerGlobalScope.applicationCache")}}</p> - -<h2 id="Voir_aussi">Voir aussi</h2> - -<ul> - <li>{{domxref("SharedWorkerGlobalScope")}}</li> -</ul> +- {{domxref("SharedWorkerGlobalScope")}} diff --git a/files/fr/web/api/sharedworkerglobalscope/index.md b/files/fr/web/api/sharedworkerglobalscope/index.md index d3887aafa0..fa6e1782c2 100644 --- a/files/fr/web/api/sharedworkerglobalscope/index.md +++ b/files/fr/web/api/sharedworkerglobalscope/index.md @@ -11,122 +11,91 @@ tags: - Web Workers translation_of: Web/API/SharedWorkerGlobalScope --- -<div>{{APIRef("Web Workers API")}}</div> - -<p>The <strong><code>SharedWorkerGlobalScope</code></strong> object (the {{domxref("SharedWorker")}} global scope) is accessible through the {{domxref("window.self","self")}} keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the <a href="/en-US/docs/Web/JavaScript/Reference">JavaScript Reference</a>. See the complete list of <a href="/en-US/docs/Web/API/Web_Workers_API/Functions_and_classes_available_to_workers">functions available to workers</a>.</p> - -<h2 id="Properties">Properties</h2> - -<p><em>This interface inherits properties from the {{domxref("WorkerGlobalScope")}} interface, and its parent {{domxref("EventTarget")}}, and therefore implements properties from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, and {{domxref("WindowEventHandlers")}}.</em></p> - -<dl> - <dt>{{domxref("SharedWorkerGlobalScope.name")}} {{readOnlyinline}}</dt> - <dd>The name that the {{domxref("SharedWorker")}} was (optionally) given when it was created using the {{domxref("SharedWorker.SharedWorker", "SharedWorker()")}} constructor. This is mainly useful for debugging purposes.</dd> - <dt>{{domxref("SharedWorkerGlobalScope.applicationCache")}} {{readOnlyinline}} {{deprecated_inline}}</dt> - <dd>This property returns the {{domxref("ApplicationCache")}} object for the worker (see <a href="/en-US/docs/Web/HTML/Using_the_application_cache">Using the application cache</a>).</dd> -</dl> - -<h3 id="Properties_inherited_from_WorkerGlobalScope">Properties inherited from WorkerGlobalScope</h3> - -<dl> - <dt>{{domxref("WorkerGlobalScope.self")}}</dt> - <dd>Returns an object reference to the <code>DedicatedWorkerGlobalScope</code> object itself.</dd> - <dt>{{domxref("WorkerGlobalScope.console")}} {{readOnlyinline}}</dt> - <dd>Returns the {{domxref("Console")}} associated with the worker.</dd> - <dt>{{domxref("WorkerGlobalScope.location")}} {{readOnlyinline}}</dt> - <dd>Returns the {{domxref("WorkerLocation")}} associated with the worker. <code>WorkerLocation</code> is a specific location object, mostly a subset of the {{domxref("Location")}} for browsing scopes, but adapted to workers.</dd> - <dt>{{domxref("WorkerGlobalScope.navigator")}} {{readOnlyinline}}</dt> - <dd>Returns the {{domxref("WorkerNavigator")}} associated with the worker. <code>WorkerNavigator</code> is a specific navigator object, mostly a subset of the {{domxref("Navigator")}} for browsing scopes, but adapted to workers.</dd> - <dt>{{domxref("WorkerGlobalScope.performance")}} {{readOnlyinline}} {{Non-standard_inline}}</dt> - <dd>Returns the {{domxref("Performance")}} object associated with the worker, which is a regular performance object, but with a subset of its properties and methods available.</dd> -</dl> - -<h3 id="Event_handlers">Event handlers</h3> - -<p><em>This interface inherits event handlers from the {{domxref("WorkerGlobalScope")}} interface, and its parent {{domxref("EventTarget")}}, and therefore implements event handlers from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, and {{domxref("WindowEventHandlers")}}.</em></p> - -<dl> - <dt>{{domxref("SharedWorkerGlobalScope.onconnect")}}</dt> - <dd>Is an {{event("Event_handlers", "event handler")}} representing the code to be called when the {{event("connect")}} event is raised — that is, when a {{domxref("MessagePort")}} connection is opened between the associated {{domxref("SharedWorker")}} and the main thread.</dd> -</dl> - -<h2 id="Methods">Methods</h2> - -<p><em>This interface inherits methods from the {{domxref("WorkerGlobalScope")}} interface, and its parent {{domxref("EventTarget")}}, and therefore implements methods from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, and {{domxref("WindowEventHandlers")}}.</em></p> - -<dl> - <dt>{{domxref("SharedWorkerGlobalScope.close()")}}</dt> - <dd>Discards any tasks queued in the <code>SharedWorkerGlobalScope</code>'s event loop, effectively closing this particular scope.</dd> -</dl> - -<h3 id="Inherited_from_WorkerGlobalScope">Inherited from WorkerGlobalScope</h3> - -<dl> - <dt>{{domxref("WorkerGlobalScope.close()")}} {{deprecated_inline}}</dt> - <dd>Discards any tasks queued in the <code>WorkerGlobalScope</code>'s event loop, effectively closing this particular scope.</dd> - <dt>{{domxref("WorkerGlobalScope.dump()")}} {{non-standard_inline}}</dt> - <dd>Allows you to write a message to stdout — i.e. in your terminal. This is the same as Firefox's {{domxref("window.dump")}}, but for workers.</dd> - <dt>{{domxref("WorkerGlobalScope.importScripts()")}}</dt> - <dd>Imports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example:<code> importScripts('foo.js', 'bar.js');</code></dd> -</dl> - -<h3 id="Implemented_from_other_places">Implemented from other places</h3> - -<dl> - <dt>{{domxref("WindowBase64.atob()")}}</dt> - <dd>Decodes a string of data which has been encoded using base-64 encoding.</dd> - <dt>{{domxref("WindowBase64.btoa()")}}</dt> - <dd>Creates a base-64 encoded ASCII string from a string of binary data.</dd> - <dt>{{domxref("WindowTimers.clearInterval()")}}</dt> - <dd>Cancels the repeated execution set using {{domxref("WindowTimers.setInterval()")}}.</dd> - <dt>{{domxref("WindowTimers.clearTimeout()")}}</dt> - <dd>Cancels the repeated execution set using {{domxref("WindowTimers.setTimeout()")}}.</dd> - <dt>{{domxref("WindowTimers.setInterval()")}}</dt> - <dd>Schedules the execution of a function every X milliseconds.</dd> - <dt>{{domxref("WindowTimers.setTimeout()")}}</dt> - <dd>Sets a delay for executing a function.</dd> -</dl> - -<h2 id="Events">Events</h2> - -<p>Listen to this event using <code><a href="/en-US/docs/Web/API/EventTarget/addEventListener">addEventListener()</a></code> or by assigning an event listener to the <code>on<em>eventname</em></code> property of this interface.</p> - -<dl> - <dt><code><a href="/en-US/docs/Web/API/SharedWorkerGlobalScope/connect_event">connect</a></code></dt> - <dd>Fired on shared workers when a new client connects.<br> - Also available via the <code><a href="/en-US/docs/Web/API/SharedWorkerGlobalScope/onconnect">onconnect</a></code> property.</dd> -</dl> - -<h2 id="Specifications">Specifications</h2> - -<table class="standard-table"> - <thead> - <tr> - <th scope="col">Specification</th> - <th scope="col">Status</th> - <th scope="col">Comment</th> - </tr> - </thead> - <tbody> - <tr> - <td>{{SpecName('HTML WHATWG', '#sharedworkerglobalscope', 'SharedWorkerGlobalScope')}}</td> - <td>{{Spec2('HTML WHATWG')}}</td> - <td></td> - </tr> - </tbody> -</table> - -<h2 id="Browser_compatibility">Browser compatibility</h2> - - - -<p>{{Compat("api.SharedWorkerGlobalScope")}}</p> - -<h2 id="See_also">See also</h2> - -<ul> - <li>{{domxref("SharedWorker")}}</li> - <li>{{domxref("WorkerGlobalScope")}}</li> - <li><a href="/en-US/docs/Web/API/Web_Workers_API/Using_web_workers">Using Web workers</a></li> - <li><a href="/en-US/docs/Web/Guide/Needs_categorization/Functions_available_to_workers">Functions available to workers</a></li> -</ul> +{{APIRef("Web Workers API")}} + +The **`SharedWorkerGlobalScope`** object (the {{domxref("SharedWorker")}} global scope) is accessible through the {{domxref("window.self","self")}} keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the [JavaScript Reference](/en-US/docs/Web/JavaScript/Reference). See the complete list of [functions available to workers](/en-US/docs/Web/API/Web_Workers_API/Functions_and_classes_available_to_workers). + +## Properties + +_This interface inherits properties from the {{domxref("WorkerGlobalScope")}} interface, and its parent {{domxref("EventTarget")}}, and therefore implements properties from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, and {{domxref("WindowEventHandlers")}}._ + +- {{domxref("SharedWorkerGlobalScope.name")}} {{readOnlyinline}} + - : The name that the {{domxref("SharedWorker")}} was (optionally) given when it was created using the {{domxref("SharedWorker.SharedWorker", "SharedWorker()")}} constructor. This is mainly useful for debugging purposes. +- {{domxref("SharedWorkerGlobalScope.applicationCache")}} {{readOnlyinline}} {{deprecated_inline}} + - : This property returns the {{domxref("ApplicationCache")}} object for the worker (see [Using the application cache](/en-US/docs/Web/HTML/Using_the_application_cache)). + +### Properties inherited from WorkerGlobalScope + +- {{domxref("WorkerGlobalScope.self")}} + - : Returns an object reference to the `DedicatedWorkerGlobalScope` object itself. +- {{domxref("WorkerGlobalScope.console")}} {{readOnlyinline}} + - : Returns the {{domxref("Console")}} associated with the worker. +- {{domxref("WorkerGlobalScope.location")}} {{readOnlyinline}} + - : Returns the {{domxref("WorkerLocation")}} associated with the worker. `WorkerLocation` is a specific location object, mostly a subset of the {{domxref("Location")}} for browsing scopes, but adapted to workers. +- {{domxref("WorkerGlobalScope.navigator")}} {{readOnlyinline}} + - : Returns the {{domxref("WorkerNavigator")}} associated with the worker. `WorkerNavigator` is a specific navigator object, mostly a subset of the {{domxref("Navigator")}} for browsing scopes, but adapted to workers. +- {{domxref("WorkerGlobalScope.performance")}} {{readOnlyinline}} {{Non-standard_inline}} + - : Returns the {{domxref("Performance")}} object associated with the worker, which is a regular performance object, but with a subset of its properties and methods available. + +### Event handlers + +_This interface inherits event handlers from the {{domxref("WorkerGlobalScope")}} interface, and its parent {{domxref("EventTarget")}}, and therefore implements event handlers from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, and {{domxref("WindowEventHandlers")}}._ + +- {{domxref("SharedWorkerGlobalScope.onconnect")}} + - : Is an {{event("Event_handlers", "event handler")}} representing the code to be called when the {{event("connect")}} event is raised — that is, when a {{domxref("MessagePort")}} connection is opened between the associated {{domxref("SharedWorker")}} and the main thread. + +## Methods + +_This interface inherits methods from the {{domxref("WorkerGlobalScope")}} interface, and its parent {{domxref("EventTarget")}}, and therefore implements methods from {{domxref("WindowTimers")}}, {{domxref("WindowBase64")}}, and {{domxref("WindowEventHandlers")}}._ + +- {{domxref("SharedWorkerGlobalScope.close()")}} + - : Discards any tasks queued in the `SharedWorkerGlobalScope`'s event loop, effectively closing this particular scope. + +### Inherited from WorkerGlobalScope + +- {{domxref("WorkerGlobalScope.close()")}} {{deprecated_inline}} + - : Discards any tasks queued in the `WorkerGlobalScope`'s event loop, effectively closing this particular scope. +- {{domxref("WorkerGlobalScope.dump()")}} {{non-standard_inline}} + - : Allows you to write a message to stdout — i.e. in your terminal. This is the same as Firefox's {{domxref("window.dump")}}, but for workers. +- {{domxref("WorkerGlobalScope.importScripts()")}} + - : Imports one or more scripts into the worker's scope. You can specify as many as you'd like, separated by commas. For example:` importScripts('foo.js', 'bar.js');` + +### Implemented from other places + +- {{domxref("WindowBase64.atob()")}} + - : Decodes a string of data which has been encoded using base-64 encoding. +- {{domxref("WindowBase64.btoa()")}} + - : Creates a base-64 encoded ASCII string from a string of binary data. +- {{domxref("WindowTimers.clearInterval()")}} + - : Cancels the repeated execution set using {{domxref("WindowTimers.setInterval()")}}. +- {{domxref("WindowTimers.clearTimeout()")}} + - : Cancels the repeated execution set using {{domxref("WindowTimers.setTimeout()")}}. +- {{domxref("WindowTimers.setInterval()")}} + - : Schedules the execution of a function every X milliseconds. +- {{domxref("WindowTimers.setTimeout()")}} + - : Sets a delay for executing a function. + +## Events + +Listen to this event using [`addEventListener()`](/en-US/docs/Web/API/EventTarget/addEventListener) or by assigning an event listener to the `oneventname` property of this interface. + +- [`connect`](/en-US/docs/Web/API/SharedWorkerGlobalScope/connect_event) + - : Fired on shared workers when a new client connects. + Also available via the [`onconnect`](/en-US/docs/Web/API/SharedWorkerGlobalScope/onconnect) property. + +## Specifications + +| Specification | Status | Comment | +| ------------------------------------------------------------------------------------------------------------ | -------------------------------- | ------- | +| {{SpecName('HTML WHATWG', '#sharedworkerglobalscope', 'SharedWorkerGlobalScope')}} | {{Spec2('HTML WHATWG')}} | | + +## Browser compatibility + +{{Compat("api.SharedWorkerGlobalScope")}} + +## See also + +- {{domxref("SharedWorker")}} +- {{domxref("WorkerGlobalScope")}} +- [Using Web workers](/en-US/docs/Web/API/Web_Workers_API/Using_web_workers) +- [Functions available to workers](/en-US/docs/Web/Guide/Needs_categorization/Functions_available_to_workers) diff --git a/files/fr/web/api/sharedworkerglobalscope/onconnect/index.md b/files/fr/web/api/sharedworkerglobalscope/onconnect/index.md index 88b05cd2d7..f14a8d0b4b 100644 --- a/files/fr/web/api/sharedworkerglobalscope/onconnect/index.md +++ b/files/fr/web/api/sharedworkerglobalscope/onconnect/index.md @@ -3,21 +3,24 @@ title: SharedWorkerGlobalScope.onconnect slug: Web/API/SharedWorkerGlobalScope/onconnect translation_of: Web/API/SharedWorkerGlobalScope/onconnect --- -<p>{{APIRef("Web Workers API")}}</p> +{{APIRef("Web Workers API")}} -<p>La proriété <strong><code>onconnect</code></strong> de l'interface {{domxref("SharedWorkerGlobalScope")}} est un gestionnaire d'évènement pour l'évènement {{event("connect")}}, c'est à dire quand une connexion {{domxref("MessagePort")}} est ouverte entre le {{domxref("SharedWorker")}} et le <em>thread</em> principale.</p> +La proriété **`onconnect`** de l'interface {{domxref("SharedWorkerGlobalScope")}} est un gestionnaire d'évènement pour l'évènement {{event("connect")}}, c'est à dire quand une connexion {{domxref("MessagePort")}} est ouverte entre le {{domxref("SharedWorker")}} et le _thread_ principale. -<h2 id="Syntaxe">Syntaxe</h2> +## Syntaxe -<pre class="brush: js">onconnect = function() { ... };</pre> +```js +onconnect = function() { ... }; +``` -<h2 id="Exemple">Exemple</h2> +## Exemple -<p>Cet exemple montre le gestionnaire d'évènement <code>onconnect</code> quand une connection depuis le thread principal vers un fichier de <em>worker</em> partagé via un {{domxref("MessagePort")}}. L'objet évènement est un {{domxref("MessageEvent")}}.</p> +Cet exemple montre le gestionnaire d'évènement `onconnect` quand une connection depuis le thread principal vers un fichier de _worker_ partagé via un {{domxref("MessagePort")}}. L'objet évènement est un {{domxref("MessageEvent")}}. -<p>Le port de connexion peut-être récupéré avec la propriété <code>ports</code> de l'objet évènement. Le port a un gestionnaire d'évènement <code>onmessage</code> pour gérer les évènement venant de cet port et la méthode <code>postMessage()</code> peut-être utilisée pour répondre au <em>thread</em> principale qui utilise le <em>worker</em>.</p> +Le port de connexion peut-être récupéré avec la propriété `ports` de l'objet évènement. Le port a un gestionnaire d'évènement `onmessage` pour gérer les évènement venant de cet port et la méthode `postMessage()` peut-être utilisée pour répondre au _thread_ principale qui utilise le _worker_. -<pre class="brush: js">onconnect = function(e) { +```js +onconnect = function(e) { var port = e.ports[0]; port.onmessage = function(e) { @@ -26,39 +29,23 @@ translation_of: Web/API/SharedWorkerGlobalScope/onconnect } port.start(); -}</pre> +} +``` -<p>Pour l'exemple complet en fonctionnement, voir <a href="https://github.com/mdn/simple-shared-worker">Basic shared worker example</a> (<a href="http://mdn.github.io/simple-shared-worker/">run shared worker</a>.)</p> +Pour l'exemple complet en fonctionnement, voir [Basic shared worker example](https://github.com/mdn/simple-shared-worker) ([run shared worker](http://mdn.github.io/simple-shared-worker/).) -<div class="note"> -<p><strong>Note :</strong> La propriété <code>data</code> de l'objet évènement est <code>null</code> dans Firefox. À partir de la version 65, elle est initialisée comme une chaîne vide, selon les spécifications ({{bug(1508824)}}).</p> -</div> +> **Note :** La propriété `data` de l'objet évènement est `null` dans Firefox. À partir de la version 65, elle est initialisée comme une chaîne vide, selon les spécifications ({{bug(1508824)}}). -<h2 id="Spécifications">Spécifications</h2> +## Spécifications -<table class="standard-table"> - <tbody> - <tr> - <th scope="col">Spécification</th> - <th scope="col">Status</th> - <th scope="col">Commentaire</th> - </tr> - <tr> - <td>{{SpecName('HTML WHATWG', '#handler-sharedworkerglobalscope-onconnect', 'onconnect')}}</td> - <td>{{Spec2('HTML WHATWG')}}</td> - <td></td> - </tr> - </tbody> -</table> +| Spécification | Status | Commentaire | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------- | ----------- | +| {{SpecName('HTML WHATWG', '#handler-sharedworkerglobalscope-onconnect', 'onconnect')}} | {{Spec2('HTML WHATWG')}} | | -<h2 id="Browser_Compatibility">Compatibilité des navigateurs</h2> +## Compatibilité des navigateurs +{{Compat("api.SharedWorkerGlobalScope.onconnect")}} +## Voir aussi -<p>{{Compat("api.SharedWorkerGlobalScope.onconnect")}}</p> - -<h2 id="Voir_aussi">Voir aussi</h2> - -<ul> - <li>{{domxref("SharedWorkerGlobalScope")}}</li> -</ul> +- {{domxref("SharedWorkerGlobalScope")}} |