diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md index 8187a8401a33d67188ef0b0847f2b2f379f85775..f834c262558c208579f0c4330547acac615a7fa0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md @@ -2599,4 +2599,53 @@ startAbilityByCallWithAccount(want: Want, accountId: number): Promise<Caller& // 处理入参错误异常 console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } + ``` + +## UIAbilityContext.reportDrawnCompleted + +reportDrawnCompleted(callback: AsyncCallback): void; + +当页面加载完成(loadContent成功)时,为开发者提供打点功能(callback形式)。 + **系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<void> | 是 | 页面加载完成打点的回调函数。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------- | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + +**示例:** + + ```ts +onWindowStageCreate(windowStage: Window.WindowStage) { + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + return; + } + try { + this.context.reportDrawnCompleted((err) => { + if (err.code) { + // 处理业务逻辑错误 + console.error(`reportDrawnCompleted failed, code is ${err.code}, message is ${err.message}`); + return; + } + // 执行正常业务 + console.info('reportDrawnCompleted succeed'); + }); + } catch (err) { + // 捕获同步的参数错误 + console.error(`reportDrawnCompleted failed, code is ${err.code}, message is ${err.message}`); + } + }); + console.log("MainAbility onWindowStageCreate") +} ``` \ No newline at end of file