From 8157e64265dd902eb5402494b3dca3bd31c36f6e Mon Sep 17 00:00:00 2001 From: Wang Hui Date: Fri, 5 Aug 2022 10:19:31 +0800 Subject: [PATCH] fixed 61bf754 from https://gitee.com/cr_wanghui/interface_sdk-js/pulls/2363 Implement the function of saving offline web pages. Add new api WebAsyncController.storeWebArchive(baseName: string, autoName: boolean): Promise; WebAsyncController.storeWebArchive(baseName: string, autoName: boolean, callback?: (result: string) => void). Signed-off-by: Wang Hui --- api/@ohos.web.webview.d.ts | 49 +++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/api/@ohos.web.webview.d.ts b/api/@ohos.web.webview.d.ts index aaf4b13fbf..c044f40b8f 100644 --- a/api/@ohos.web.webview.d.ts +++ b/api/@ohos.web.webview.d.ts @@ -122,6 +122,53 @@ declare namespace webview { */ static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void; } + + /** + * Provides asynchronous methods for manage the webview. + * + * @since 9 + */ + class WebAsyncController { + /** + * Constructor. + * + * @param controller WebAsyncController needs a WebController to associate with corresponding nweb. + * + * @since 9 + */ + constructor(controller: WebController); + + /** + * Stores the current page as a web archive. + * + * @param baseName Where the generated offline webpage is stored, This value cannot be null. + * @param autoName If it is false, the filename will be automatically generated according to + * the url and the generated offline webpage will be stored in the directory + * specified by baseName. If it is true, the offline webpage will be directly + * stored in the path specified by baseName. + * @returns a promise resolved after the web archive has been stored. The parameter will either + * be the filename under which the file was stored, or empty if storing the file failed. + * + * @since 9 + */ + storeWebArchive(baseName: string, autoName: boolean): Promise; + + /** + * Stores the current page as a web archive. + * + * @param baseName Where the generated offline webpage is stored, This value cannot be null. + * @param autoName If it is false, the filename will be automatically generated according to + * the url and the generated offline webpage will be stored in the directory + * specified by baseName. If it is true, the offline webpage will be directly + * stored in the path specified by baseName. + * @param callback called after the web archive has been stored. The parameter will either be + * the filename under which the file was stored, or empty if storing + * the file failed. + * + * @since 9 + */ + storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback): void; + } } -export default webview; \ No newline at end of file +export default webview; -- Gitee