From c7ad6d3d09d3b0d0a4c5c2b6a88541602c7700d7 Mon Sep 17 00:00:00 2001 From: lixingchi1 Date: Mon, 17 Jan 2022 11:56:56 +0800 Subject: [PATCH] lixingchi1@huawei.com Signed-off-by: lixingchi1 --- BUILD.gn | 1 + api/@internal/component/ets/index.d.ts | 1 + api/@internal/component/ets/web.d.ts | 54 ++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 api/@internal/component/ets/web.d.ts diff --git a/BUILD.gn b/BUILD.gn index 38c871c843..a6eb9c2bdb 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -102,6 +102,7 @@ ohos_copy("ets_component") { "api/@internal/component/ets/toggle.d.ts", "api/@internal/component/ets/units.d.ts", "api/@internal/component/ets/video.d.ts", + "api/@internal/component/ets/web.d.ts", "api/@internal/component/ets/xcomponent.d.ts", ] outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ] diff --git a/api/@internal/component/ets/index.d.ts b/api/@internal/component/ets/index.d.ts index 3c4fc1ec96..b6db78203a 100644 --- a/api/@internal/component/ets/index.d.ts +++ b/api/@internal/component/ets/index.d.ts @@ -93,5 +93,6 @@ /// /// /// +/// /// /// diff --git a/api/@internal/component/ets/web.d.ts b/api/@internal/component/ets/web.d.ts new file mode 100644 index 0000000000..a45cfc58a7 --- /dev/null +++ b/api/@internal/component/ets/web.d.ts @@ -0,0 +1,54 @@ +declare class WebController { + constructor(); + /** + * Means to load a piece of code and execute JS code in the context of the currently displayed page + * @since 8 + */ + evaluateJavaScript(jscode: string); + /** + * Indicates that a piece of code is loaded + * @since 8 + */ + loadDataWithBaseURL(value : {baseUrl: string, data: string, mimeType:string, encoding:string, historyUrl: string}); + /** + * Load the given URL + * @since 8 + */ + loadUrl(url : string); +} +declare interface WebOptions { + /** + * Set the address of the web page to be displayed + * @since 8 + */ + src: string | Resource; + controller: WebController; +} +interface Web extends WebAttribute { + (value: WebOptions): Web; +} +declare class WebAttribute extends CommonMethod { + /** + * Triggered at the end of web page loading + * @since 8 + */ + onPageFinish(callback: (event?:{ url: string }) => void): T; + /** + * Get WebView focus callback event + * @since 8 + */ + onRequestFocus(event: () => void): T; + /** + * Set whether WebView allows JavaScript scripts to execute + * @since 8 + */ + javaScriptEnabled(value: boolean): T; + /** + * Enable or disable local file system access in WebView + * @since 8 + */ + fileAccessEnabled(value: boolean): T; +} +declare class WebExtend extends WebAttribute { +} +declare const Web: Web; -- Gitee