diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index ade286994b58bc024a16e978fd7393d343935965..df04421937a9a40449b0c6e37792fb6050429d48 100644 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -5430,6 +5430,42 @@ declare interface OnPageBeginEvent { url: string; } +/** + * Defines the triggered function at the begin of web page loading. + * + * @typedef OnLoadStartedEvent + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +declare interface OnLoadStartedEvent { + /** + * The url to be loaded. + * + * @type { string } + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ + url: string; +} + +/** + * Defines the triggered function at the end of web page loading. + * + * @typedef OnLoadFinishedEvent + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ +declare interface OnLoadFinishedEvent { + /** + * The url to be loaded. + * + * @type { string } + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ + url: string; +} + /** * Defines the triggered function when the page loading progress changes. * @@ -7610,6 +7646,37 @@ declare class WebAttribute extends CommonMethod { */ onPageBegin(callback: Callback): WebAttribute; + /** + * Triggered at the begin of web page loading. This method is called once for each main frame load. Embedded frame + * changes, i.e. clicking a link whose target is an iframe and fragment navigations (navigations to #fragment_id) + * will not trigger this callback. + * + *

API Note:
+ * Different from onPageBegin, onLoadStarted is triggered only once if the mainframe is automatically redirected + * before the page is completely loaded. OnPageBegin is triggered every navigation. + *

+ * + * @param { Callback } callback The triggered function at the begin of web page loading. + * @returns { WebAttribute } + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ + onLoadStarted(callback: Callback): WebAttribute; + + /** + * Notify the host application that a page has finished loading. This method is called only for main frame. + * + *

API Note:
+ * Different from onPageEnd, fragment navigation also triggers onLoadFinished. + *

+ * + * @param { Callback } callback The triggered function at the end of web page loading. + * @returns { WebAttribute } + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + */ + onLoadFinished(callback: Callback): WebAttribute; + /** * Triggered when the page loading progress changes. *