From c82c43e9cbd4532d46ada45afd4ce3c11967ca2a Mon Sep 17 00:00:00 2001 From: j30052480 Date: Sun, 6 Jul 2025 16:27:08 +0800 Subject: [PATCH] feat: support notify pdf load and scroll at bottom event Signed-off-by: j30052480 --- api/@internal/component/ets/web.d.ts | 127 +++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index c905bb910f..d008378f4b 100644 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -6772,6 +6772,57 @@ declare interface OnOverScrollEvent { yOffset: number; } +/** + * Defines the function Triggered when the PDF page scrolling. + * + * @typedef OnPdfScrollEvent + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ +declare interface OnPdfScrollEvent { + + /** + * PDF page url. + * + * @type { string } + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ + url:string; +} + +/** + * Defines the function Triggered when the PDF load. + * + * @typedef OnPdfLoadEvent + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ +declare interface OnPdfLoadEvent { + /** + * The PDF page load result. + * + * @type { PdfLoadResult } + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ + result: PdfLoadResult; + + /** + * The PDF page url. + * + * @type { string } + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ + url: string; +} + /** * Defines the JavaScript object to be injected. * @@ -7024,6 +7075,62 @@ declare enum AudioSessionType { AMBIENT=3 } +/** + * PDF page load result + * + * @enum { number } + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ +declare enum PdfLoadResult { + + /** + * The PDF page load success. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ + LOAD_SUCCESS = 0, + + /** + * The error code for web load PDF file failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ + PARSE_ERROR_FILE = 1, + + /** + * The error code for the PDF format is not support. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ + PARSE_ERROR_FORMAT = 2, + + /** + * The error code for the PDF password is wrong. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ + PARSE_ERROR_PASSWORD = 3, + + /** + * The error code for the PDF handler process failed. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ + PARSE_ERROR_HANDLER = 4 +} + /** * Defines the options of preview menu * @@ -9618,6 +9725,26 @@ declare class WebAttribute extends CommonMethod { */ onOverScroll(callback: Callback): WebAttribute; + /** + * Triggered when the PDF in web page scrolling at bottom with pdf scroll event. + * @param { Callback } callback Function Triggered when the scrolling to bottom. + * @returns { WebAttribute } + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ + onPdfScrollAtBottom(callback: Callback): WebAttribute; + + /** + * Triggered when the PDF page load finish. + * @param { Callback } callback + * @returns { WebAttribute } + * @syscap SystemCapability.Web.Webview.Core + * @since 20 + * @arkts 1.1&1.2 + */ + onPdfLoadEvent(callback: Callback): WebAttribute; + /** * Called when received website security risk check result. * -- Gitee