profileStart()

标记一个 trace event 的开始。

语法

profileStart(name: string, option?: { flowId: number, arg?:  Record<string, string>}): void;

参数

name

trace event 的名称。

option(可选)

额外选项,例如 flowId 和自定义参数(arg)。

示例

// 开始一个 trace event。
lynx.performance.profileStart('DataFetch');

// 开始一个 trace event 并添加自定义参数
lynx.performance.profileStart('DataFetch', {
  args: { url: 'https://api.example.com/data', method: 'GET' },
});

// 开始一个 flow 类型的 trace event
const flowId = lynx.performance.profileFlowId();
lynx.performance.profileStart('UserAction', { flowId });

// 开始一个 flow 类型的 trace event 并添加自定义参数
lynx.performance.profileStart('ComplexProcess', {
  args: { step: 'start' },
  flowId,
});

兼容性

LCD tables only load in the browser

除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。