Back to Lynx

{{ api.name }}

tools/api/docs/templates/set-extra-timing.mdx

3.7.04.9 KB
Original Source

{{ api.name }}

This interface is used to supplement key performance data before loading the Lynx page, specifically including the following items from InitContainerEntry:

  • Page open time (openTime)
  • Timestamp for the start of preparing the TemplateBundle (prepareTemplateStart)
  • Timestamp for the end of preparing the TemplateBundle (prepareTemplateEnd)
  • Timestamp for the start of container initialization (containerInitStart)
  • Timestamp for the end of container initialization (containerInitEnd)

Upon successfully updating all timestamps using this interface, the InitContainerEntry performance event will be triggered. Depending on the timing of the configuration, it may also trigger the calculation of fcp, totalFcp, actualFmp, and totalActualFmp metrics, along with dispatching new performance events for MetricFcpEntry and MetricActualFmpEntry.

:::caution Timestamps within extraTiming cannot be overwritten, meaning that multiple calls to this interface attempting to repeatedly update a timestamp will yield no effect. :::

Syntax

{% if api.android_member %}

Android

java
{{ api.android_member.prototype }}

{% if api.android_member.params %}

Parameters

{% for param in api.android_member.params %}

  • {{ param.name }}: {{ param.brief_desc }} {% endfor %} {% endif %} {% if api.android_member.returns.brief_desc %}

Return

  • {{ api.android_member.returns.brief_desc }} {% endif %}

The specific definition of ExtraTimingInfo is as follows:

java
public static class ExtraTimingInfo {
    // Page open time, corresponds to openTime in InitContainerEntry.
    public long mOpenTime = 0;
    // Timestamp for the start of preparing the TemplateBundle, corresponds to prepareTemplateStart in InitContainerEntry.
    public long mPrepareTemplateStart = 0;
    // Timestamp for the end of preparing the TemplateBundle, corresponds to prepareTemplateEnd in InitContainerEntry.
    public long mPrepareTemplateEnd = 0;
    // Timestamp for the start of container initialization, corresponds to containerInitStart in InitContainerEntry.
    public long mContainerInitStart = 0;
    // Timestamp for the end of container initialization, corresponds to containerInitEnd in InitContainerEntry.
    public long mContainerInitEnd = 0;
}

{% endif %} {% if api.ios_member %}

iOS

objc
{{ api.ios_member.prototype }}

{% if api.ios_member.params %}

Parameters

{% for param in api.ios_member.params %}

  • {{ param.name }}: {{ param.brief_desc }} {% endfor %} {% endif %} {% if api.ios_member.returns.brief_desc %}

Return

  • {{ api.ios_member.returns.brief_desc }} {% endif %}

The specific definition of LynxExtraTiming is as follows:

objc
@interface LynxExtraTiming : NSObject

// Page open time, corresponds to openTime in InitContainerEntry.
@property(nonatomic, assign) uint64_t openTime;
// Timestamp for the start of preparing the TemplateBundle, corresponds to prepareTemplateStart in InitContainerEntry.
@property(nonatomic, assign) uint64_t prepareTemplateStart;
// Timestamp for the end of preparing the TemplateBundle, corresponds to prepareTemplateEnd in InitContainerEntry.
@property(nonatomic, assign) uint64_t prepareTemplateEnd;
// Timestamp for the start of container initialization, corresponds to containerInitStart in InitContainerEntry.
@property(nonatomic, assign) uint64_t containerInitStart;
// Timestamp for the end of container initialization, corresponds to containerInitEnd in InitContainerEntry.
@property(nonatomic, assign) uint64_t containerInitEnd;

@end

{% endif %} {% if api.harmony_member %}

Harmony

typescript
{{ api.harmony_member.prototype }}

{% if api.harmony_member.params %}

Parameters

{% for param in api.harmony_member.params %}

  • {{ param.name }}: {{ param.brief_desc }} {% endfor %} {% endif %} {% if api.harmony_member.returns.brief_desc %}

Return

  • {{ api.harmony_member.returns.brief_desc }} {% endif %}

The specific definition of LynxExtraTiming is as follows:

typescript
export class LynxExtraTiming {
  public static readonly OPEN_TIME = 'openTime';
  public static readonly CONTAINER_INIT_START = 'containerInitStart';
  public static readonly CONTAINER_INIT_END = 'containerInitEnd';
  public static readonly PREPARE_TEMPLATE_START = 'prepareTemplateStart';
  public static readonly PREPARE_TEMPLATE_END = 'prepareTemplateEnd';

  public openTime: number = 0;
  public containerInitStart: number = 0;
  public containerInitEnd: number = 0;
  public prepareTemplateStart: number = 0;
  public prepareTemplateEnd: number = 0;
}

{% endif %}

Compatibility

import { LegacyCompatTable } from '@lynx';

<LegacyCompatTable metadata="lynx-native-api/{{ api.parent_name }}/{{ api.kebab_name }}" />