From 4db194b74a973d7b744c4e5db4b4749de1e46740 Mon Sep 17 00:00:00 2001 From: Chanry Date: Tue, 16 Dec 2025 19:16:12 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20[Issue:=20#IDDDWX]=E4=BF=AE=E6=94=B9=20?= =?UTF-8?q?react-native-performance=20=E7=9A=84=E6=8C=87=E5=AF=BC=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Chanry --- en/react-native-performance.md | 24 ++++++++++++------------ zh-cn/react-native-performance.md | 28 ++++++++++++++-------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/en/react-native-performance.md b/en/react-native-performance.md index e50d8363..ad55c67e 100644 --- a/en/react-native-performance.md +++ b/en/react-native-performance.md @@ -382,21 +382,21 @@ Exports the **Performance** object by default. | Name | Description | Type | Required | Platform | HarmonyOS Support | | ---------- | ------------------------------------------------------- | ------ | -------- | ----------- | ----------------- | -| timeOrigin | Returns the high-resolution timestamp used by **Performance** as the performance-related baseline timestamp.| number | yes | IOS/Android | yes | +| timeOrigin | Returns the high-resolution timestamp used by **Performance** as the performance-related baseline timestamp.| number | no | IOS/Android | yes | #### Performance method | Name | Description | Type | Required | Platform | HarmonyOS Support | | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | ----------- | ----------------- | -| now | Returns a high-resolution timestamp, in milliseconds. | function | yes | IOS/Android | yes | -| mark | Creates a timestamp in the performance input buffer based on the given **markName** value. | function | yes | IOS/Android | yes | -| measure | Creates a measure record in the performance record cache. If only the measure name is specified, the start timestamp is set to zero, and the end timestamp (used to calculate the duration) is the value returned by **Performance.now()**. You can use a string to set the **PerformanceMark** object to a start tag and an end tag. If only the **endMark** is provided, you need to set an empty measure option object: **performance.Measure("myMeasure", {}, "myEndMarker")**.| function | yes | IOS/Android | yes | -| metric | Generates entries of the **metric** type if you want to collect custom metrics that are not time-based. This function is an extension of the Performance API. | function | yes | IOS/Android | yes | -| getEntries | Returns a **PerformanceEntry** object array if a **filter** is specified; returns all entries if no parameter is specified. | function | yes | IOS/Android | yes | -| getEntriesByName | Returns an array of **PerformanceEntry** objects with the given **name** and **type**. | function | yes | IOS/Android | yes | -| getEntriesByType | Returns a **PerformanceEntry** object array with the given **type**. | function | yes | IOS/Android | yes | -| clearMarks | Removes the declared marks from the cache. If no parameter is passed, all performance entries with the **entry type** mark are removed from the performance entry cache. | function | yes | IOS/Android | yes | -| clearMeasures | Removes the declared measure records from the cache. If no parameter is passed, all performance entities whose **entry type** is **measure** are removed from the performance entry cache. | function | yes | IOS/Android | yes | +| now | Returns a high-resolution timestamp, in milliseconds. | function | no | IOS/Android | yes | +| mark | Creates a timestamp in the performance input buffer based on the given **markName** value. | function | no | IOS/Android | yes | +| measure | Creates a measure record in the performance record cache. If only the measure name is specified, the start timestamp is set to zero, and the end timestamp (used to calculate the duration) is the value returned by **Performance.now()**. You can use a string to set the **PerformanceMark** object to a start tag and an end tag. If only the **endMark** is provided, you need to set an empty measure option object: **performance.Measure("myMeasure", {}, "myEndMarker")**.| function | no | IOS/Android | yes | +| metric | Generates entries of the **metric** type if you want to collect custom metrics that are not time-based. This function is an extension of the Performance API. | function | no | IOS/Android | yes | +| getEntries | Returns a **PerformanceEntry** object array if a **filter** is specified; returns all entries if no parameter is specified. | function | no | IOS/Android | yes | +| getEntriesByName | Returns an array of **PerformanceEntry** objects with the given **name** and **type**. | function | no | IOS/Android | yes | +| getEntriesByType | Returns a **PerformanceEntry** object array with the given **type**. | function | no | IOS/Android | yes | +| clearMarks | Removes the declared marks from the cache. If no parameter is passed, all performance entries with the **entry type** mark are removed from the performance entry cache. | function | no | IOS/Android | yes | +| clearMeasures | Removes the declared measure records from the cache. If no parameter is passed, all performance entities whose **entry type** is **measure** are removed from the performance entry cache. | function | no | IOS/Android | yes | ## PerformanceObserver @@ -410,7 +410,7 @@ Generates a **PerformanceObserver** object based on the specified observer callb | Name | Description | Type | Required | Platform | HarmonyOS Support | | ------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | ----------- | ----------------- | -| observe | Specifies the performance entry type for the **PerformanceObserver** object. When a performance entry of a specified type is recorded, the callback of the performance observer object is called.| function | yes | IOS/Android | yes | +| observe | Specifies the performance entry type for the **PerformanceObserver** object. When a performance entry of a specified type is recorded, the callback of the performance observer object is called.| function | no | IOS/Android | yes | ## API @@ -420,7 +420,7 @@ Generates a **PerformanceObserver** object based on the specified observer callb | Name | Description | Type | Required | Platform | HarmonyOS Support | | ------------------------- | ----------------------------------------------------------------------------------- | -------- | -------- | ----------- | ----------------- | -| setResourceLoggingEnabled | Enables resource logging, which is disabled by default and is used only by **fetch** and **XMLHttpRequest**.| function | yes | IOS/Android | yes | +| setResourceLoggingEnabled | Enables resource logging, which is disabled by default and is used only by **fetch** and **XMLHttpRequest**.| function | no | IOS/Android | yes | ## Known Issues diff --git a/zh-cn/react-native-performance.md b/zh-cn/react-native-performance.md index a15df30e..fc102191 100644 --- a/zh-cn/react-native-performance.md +++ b/zh-cn/react-native-performance.md @@ -377,22 +377,22 @@ ohpm install > [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。 #### Performance 属性 -| 名称 | 描述 | 类型 | 是否必需 | 支持的平台 | 是否支持HarmonyOS | -| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | -------- | ----------------| ------------------ | -|timeOrigin | 返回Performance用作性能相关时间戳基线的高分辨率时间戳 | number | yes | IOS/Android | yes | +| Name | Description | Type | Required | Platform | HarmonyOS Support | +| ---- | ----------- | ----- | -------- | -----------| ------------------ | +|timeOrigin | 返回Performance用作性能相关时间戳基线的高分辨率时间戳 | number | no | IOS/Android | yes | #### Performance 方法 | Name | Description | Type | Required | Platform | HarmonyOS Support | | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | -------- | ----------------| ------------------ | -| now | 返回一个高分辨率时间戳(以毫秒为单位) | function | yes | IOS/Android | yes | -| mark | 根据给出 markName 值,在性能输入缓冲区中创建一个timestamp(时间戳) | function | yes | IOS/Android | yes | -| measure | 性能记录缓存中使用 measure()创建一个新的测量记录如果仅指定了测量名称,则开始时间戳设置为零,结束时间戳(用于计算持续时间)是Performance.now()返回的值。可以使用字符串将PerformanceMark对象标识为开始标记和结束标记。要只提供一个endMark,您需要提供一个空的测量选项对象:performance.Measure(“myMeasure”,{},“myEndMarker”) | function | yes | IOS/Android | yes | -| metric | 如果您希望收集不基于时间的自定义度量,此模块将提供名为.metric()的Performance API扩展,该扩展将生成类型为metric的条目 | function | yes | IOS/Android | yes | -| getEntries | 对于给定的 filter,此方法返回 PerformanceEntry 对象数组,如果不带任何参数,返回全部 entries | function | yes | IOS/Android | yes | -| getEntriesByName | 返回一个给定名称和 name 和 type 属性的PerformanceEntry对象数组 | function | yes | IOS/Android | yes | -| getEntriesByType | 返回一个给定type 属性的PerformanceEntry对象数组 | function | yes | IOS/Android | yes | -| clearMarks | 从缓存中移除声明的标记。如果调用这个方法时没有传递参数,则所有带有entry type这类标记的performance entries 将从 performance entry 缓存区中被移除。 | function | yes | IOS/Android | yes | -| clearMeasures | 从缓存区中移除声明的测量记录。如果这个方法被调用时没有传入参数,则所有 entry type 标记值为"measure" 的性能实体将被从性能入口缓存区中移除。 | function | yes | IOS/Android | yes | | function | yes | IOS/Android | yes +| now | 返回一个高分辨率时间戳(以毫秒为单位) | function | no | IOS/Android | yes | +| mark | 根据给出 markName 值,在性能输入缓冲区中创建一个timestamp(时间戳) | function | no | IOS/Android | yes | +| measure | 性能记录缓存中使用 measure()创建一个新的测量记录如果仅指定了测量名称,则开始时间戳设置为零,结束时间戳(用于计算持续时间)是Performance.now()返回的值。可以使用字符串将PerformanceMark对象标识为开始标记和结束标记。要只提供一个endMark,您需要提供一个空的测量选项对象:performance.Measure(“myMeasure”,{},“myEndMarker”) | function | no | IOS/Android | yes | +| metric | 如果您希望收集不基于时间的自定义度量,此模块将提供名为.metric()的Performance API扩展,该扩展将生成类型为metric的条目 | function | no | IOS/Android | yes | +| getEntries | 对于给定的 filter,此方法返回 PerformanceEntry 对象数组,如果不带任何参数,返回全部 entries | function | no | IOS/Android | yes | +| getEntriesByName | 返回一个给定名称和 name 和 type 属性的PerformanceEntry对象数组 | function | no | IOS/Android | yes | +| getEntriesByType | 返回一个给定type 属性的PerformanceEntry对象数组 | function | no | IOS/Android | yes | +| clearMarks | 从缓存中移除声明的标记。如果调用这个方法时没有传递参数,则所有带有entry type这类标记的performance entries 将从 performance entry 缓存区中被移除。 | function | no | IOS/Android | yes | +| clearMeasures | 从缓存区中移除声明的测量记录。如果这个方法被调用时没有传入参数,则所有 entry type 标记值为"measure" 的性能实体将被从性能入口缓存区中移除。 | function | no | IOS/Android | yes | | function | no | IOS/Android | yes ## PerformanceObserver @@ -405,7 +405,7 @@ ohpm install | Name | Description | Type | Required | Platform | HarmonyOS Support | | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | -------- | ----------------| ------------------ | -| observe | observe() 方法用于指定PerformanceObserver对象观察的性能条目类型。当记录一个指定类型的性能条目时,性能监测对象的回调函数将会被调用。 | function | yes | IOS/Android | yes| +| observe | observe() 方法用于指定PerformanceObserver对象观察的性能条目类型。当记录一个指定类型的性能条目时,性能监测对象的回调函数将会被调用。 | function | no | IOS/Android | yes| ## API @@ -415,7 +415,7 @@ ohpm install | Name | Description | Type | Required | Platform | HarmonyOS Support | | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- | -------- | ----------------| ------------------ | -|setResourceLoggingEnabled | 默认情况下禁用资源日志记录,并且当前仅fetch/XMLHttpRequest使用,使用时需设置开启。 | function | yes | IOS/Android | yes | +|setResourceLoggingEnabled | 默认情况下禁用资源日志记录,并且当前仅fetch/XMLHttpRequest使用,使用时需设置开启。 | function | no | IOS/Android | yes | ## 遗留问题 -- Gitee