From e2761ea9903e7796f5ced0c92e4e529f16468173 Mon Sep 17 00:00:00 2001 From: laosan_ted Date: Mon, 30 May 2022 10:14:35 +0800 Subject: [PATCH 1/3] webview add interface Signed-off-by: laosan_ted --- api/@internal/component/ets/web.d.ts | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index 9705ccca79..dcc76cf82e 100755 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -698,6 +698,18 @@ declare class WebCookie { */ zoom(factor: number): void; + /** + * Let the Web zoom in. + * @since 9 + */ + zoomIn(): boolean; + + /** + * Let the Web zoom out. + * @since 9 + */ + zoomOut(): boolean; + /** * Clears the history in the Web. * @since 8 @@ -762,6 +774,24 @@ declare class WebCookie { */ getHitTest(): HitTestType; + /** + * Gets the id for the current Web. + * @since 9 + */ + getWebId(): number; + + /** + * Gets the title of current Web page. + * @since 9 + */ + getTitle(): number; + + /** + * Gets the content height of current Web page. + * @since 9 + */ + getContentHeight(): number; + /** * Gets the request focus. * @since 8 @@ -800,6 +830,12 @@ declare class WebCookie { */ forward(); + /** + * Goes forward or back backOrForward in the history of the web page. + * @since 9 + */ + backOrForward(step: number): void; + /** * Gets network cookie manager * @since 9 @@ -980,6 +1016,14 @@ declare class WebAttribute extends CommonMethod { */ databaseAccess(databaseAccess: boolean): WebAttribute; + /** + * Sets the initial scale for the Web. + * @param percent the initial scale for the Web. + * + * @since 9 + */ + initialScale(percent: number): WebAttribute; + /** * Sets the Web's user agent. * @param userAgent The Web's user agent. @@ -1169,6 +1213,22 @@ declare class WebAttribute extends CommonMethod { * @deprecated since 9 */ onFileSelectorShow(callback: (event?: { callback: Function, fileSelector: object }) => void): WebAttribute; + + /** + * Triggered when the url loading. + * @param callback The triggered when the url loading. + * + * @since 9 + */ + onResourceLoad(callback: (event: {url: string}) => void): WebAttribute; + + /** + * Triggered when the scale of WebView changed. + * @param callback The triggered when the scale of WebView changed. + * + * @since 9 + */ + onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void): WebAttribute; } declare const Web: WebInterface; -- Gitee From e25bd5573efabf3bf6353567667146bf413b0c13 Mon Sep 17 00:00:00 2001 From: laosan_ted Date: Mon, 30 May 2022 10:40:21 +0800 Subject: [PATCH 2/3] fix Signed-off-by: laosan_ted --- api/@internal/component/ets/web.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index dcc76cf82e..ea143a01f7 100755 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -784,13 +784,13 @@ declare class WebCookie { * Gets the title of current Web page. * @since 9 */ - getTitle(): number; + getTitle(): number; /** * Gets the content height of current Web page. * @since 9 */ - getContentHeight(): number; + getContentHeight(): number; /** * Gets the request focus. @@ -834,7 +834,7 @@ declare class WebCookie { * Goes forward or back backOrForward in the history of the web page. * @since 9 */ - backOrForward(step: number): void; + backOrForward(step: number): void; /** * Gets network cookie manager -- Gitee From fd8f6973fbf1d7e02641863c69da00bfb6335f1f Mon Sep 17 00:00:00 2001 From: laosan_ted Date: Wed, 1 Jun 2022 10:32:37 +0800 Subject: [PATCH 3/3] change interface name Signed-off-by: laosan_ted --- api/@internal/component/ets/web.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts index ea143a01f7..a00c644de1 100755 --- a/api/@internal/component/ets/web.d.ts +++ b/api/@internal/component/ets/web.d.ts @@ -790,7 +790,7 @@ declare class WebCookie { * Gets the content height of current Web page. * @since 9 */ - getContentHeight(): number; + getPageHeight(): number; /** * Gets the request focus. -- Gitee