From 1407c8fdef01ecd0ffb8a8bd46e7113f119b9fde Mon Sep 17 00:00:00 2001 From: julieng Date: Sat, 2 Oct 2021 17:20:24 +0200 Subject: convert content to md --- files/fr/web/api/performanceentry/tojson/index.md | 75 ++++++++++------------- 1 file changed, 31 insertions(+), 44 deletions(-) (limited to 'files/fr/web/api/performanceentry/tojson') diff --git a/files/fr/web/api/performanceentry/tojson/index.md b/files/fr/web/api/performanceentry/tojson/index.md index 9450e8f3f0..6d02774855 100644 --- a/files/fr/web/api/performanceentry/tojson/index.md +++ b/files/fr/web/api/performanceentry/tojson/index.md @@ -11,33 +11,33 @@ tags: - Performance Web translation_of: Web/API/PerformanceEntry/toJSON --- -
{{APIRef("Performance Timeline API")}}
+{{APIRef("Performance Timeline API")}} -

La méthode toJSON() permet de sérialiser l'objet PerformanceEntry courant et renvoie une représentation JSON de l'objet.

+La méthode **`toJSON()`** permet de sérialiser l'objet [`PerformanceEntry`](/fr/docs/Web/API/PerformanceEntry) courant et renvoie une représentation JSON de l'objet. -

{{AvailableInWorkers}}

+{{AvailableInWorkers}} -

Syntaxe

+## Syntaxe -
let jsonObj = perfEntry.toJSON();
-
+```js +let jsonObj = perfEntry.toJSON(); +``` -

Arguments

+### Arguments -

Aucun.

+Aucun. -

Valeur de retour

+### Valeur de retour -
-
json
-
Un objet JSON qui est la sérialisation de l'objet PerformanceEntry.
-
+- `json` + - : Un objet JSON qui est la sérialisation de l'objet [`PerformanceEntry`](/fr/docs/Web/API/PerformanceEntry). -

Exemple

+## Exemple -

L'exemple suivant montre l'utilisation de la méthode toJSON().

+L'exemple suivant montre l'utilisation de la méthode `toJSON()`. -
function run_PerformanceEntry() {
+```js
+function run_PerformanceEntry() {
   console.log("Support de PerformanceEntry ...");
 
   if (performance.mark === undefined) {
@@ -52,7 +52,7 @@ translation_of: Web/API/PerformanceEntry/toJSON
 
   // Utilise getEntries() pour itérer à travers chaque entrée.
   let p = performance.getEntries();
-  for (let i = 0; i < p.length; i++) {
+  for (let i = 0; i < p.length; i++) {
     console.log("Entry[" + i + "]");
     check_PerformanceEntry(p[i]);
   }
@@ -61,7 +61,7 @@ function check_PerformanceEntry(obj) {
   let properties = ["name", "entryType", "startTime", "duration"];
   let methods = ["toJSON"];
 
-  for (let i = 0; i < properties.length; i++) {
+  for (let i = 0; i < properties.length; i++) {
     // On vérifie chaque propriété
     let supported = properties[i] in obj;
     if (supported)
@@ -69,7 +69,7 @@ function check_PerformanceEntry(obj) {
     else
       console.log("..." + properties[i] + " = N'est pas pris en charge");
   }
-  for (let i = 0; i < methods.length; i++) {
+  for (let i = 0; i < methods.length; i++) {
     // On vérifie chaque méthode
     let supported = typeof obj[methods[i]] == "function";
     if (supported) {
@@ -80,28 +80,15 @@ function check_PerformanceEntry(obj) {
     }
   }
 }
-
- -

Spécifications

- - - - - - - - - - - - - - - - -
SpécificationStatutCommentaire
{{SpecName('Performance Timeline Level 2', '#dom-performanceentry-tojson', - 'toJSON')}}{{Spec2('Performance Timeline Level 2')}}Définition initiale de la méthode toJSON().
- -

Compatibilité des navigateurs

- -

{{Compat("api.PerformanceEntry.toJSON")}}

+``` + +## Spécifications + +| Spécification | Statut | Commentaire | +| ---------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | --------------------------------------------- | +| {{SpecName('Performance Timeline Level 2', '#dom-performanceentry-tojson', + 'toJSON')}} | {{Spec2('Performance Timeline Level 2')}} | Définition initiale de la méthode `toJSON()`. | + +## Compatibilité des navigateurs + +{{Compat("api.PerformanceEntry.toJSON")}} -- cgit v1.2.3-54-g00ecf