From fb232cf7265a2b66065e6f48b5e47e515b0cfb38 Mon Sep 17 00:00:00 2001 From: laosan_ted Date: Mon, 4 Jul 2022 19:30:12 +0800 Subject: [PATCH] add web napi d.ts Signed-off-by: laosan_ted --- api/@ohos.web.d.ts | 127 ++++++++++++++++++++++++++++++++ api/device-define/car.json | 3 +- api/device-define/default.json | 3 +- api/device-define/tablet.json | 3 +- api/device-define/tv.json | 3 +- api/device-define/wearable.json | 3 +- 6 files changed, 137 insertions(+), 5 deletions(-) create mode 100644 api/@ohos.web.d.ts diff --git a/api/@ohos.web.d.ts b/api/@ohos.web.d.ts new file mode 100644 index 00000000000..3d462d0bfa3 --- /dev/null +++ b/api/@ohos.web.d.ts @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {AsyncCallback} from "./basic"; + +/** + * This module provides the capability to manage web modules. + * + * @since 9 + * @syscap SystemCapability.Web + */ +declare namespace web { + /** + * Provides basic information of web storage. + * @name WebStorageOrigin + * @since 9 + * @syscap SystemCapability.Web + */ + interface WebStorageOrigin { + origin: string; + usage: number; + quota: number; + } + + /** + * Provides methods for managing web storage. + * @name WebStorage + * @since 9 + * @syscap SystemCapability.Web + */ + class WebStorage { + /** + * delete all the storage data. + * + * @since 9 + */ + static deleteAllData() : void; + + /** + * delete the storage data with the origin. + * @param origin the origin which to be deleted. + * @since 9 + */ + static deleteOrigin(origin : string): void; + + /** + * Get current all the web storage origins. + * + * @since 9 + */ + static getOrigins() : Promise>; + static getOrigins(callback: AsyncCallback>) : void; + + /** + * Get the web storage quota with the origin. + * @param origin the origin which to be inquired. + * @since 9 + */ + static getOriginQuota(origin : string) : Promise; + static getOriginQuota(origin : string, callback : AsyncCallback) : void; + + /** + * Get the web storage quota with the origin. + * @param origin the origin which to be inquired. + * @since 9 + */ + static getOriginUsage(origin : string) : Promise ; + static getOriginUsage(origin : string, callback : AsyncCallback) : void; + } + + /** + * Provides methods for managing web database. + * @name WebDataBase + * @since 9 + * @syscap SystemCapability.Web + */ + class WebDataBase { + /** + * Get whether instances holds any http authentication credentials. + * @return true if instances saved any http authentication credentials otherwise false. + * + * @since 9 + */ + static existHttpAuthCredentials(): boolean; + + /** + * delete all http authentication credentials. + * + * @since 9 + */ + static deleteHttpAuthCredentials(): void; + + /** + * get http authentication credentials. + * @param host the host to which the credentials apply. + * @param realm the realm to which the credentials apply. + * @return Return an array containing username and password. + * @since 9 + */ + static getHttpAuthCredentials(host: string, realm: string): Array; + + /** + * save http authentication credentials. + * @param host the host to which the credentials apply. + * @param realm the realm to which the credentials apply. + * @param username the username. + * @param password the password. + * + * @since 9 + */ + static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void; + } +} + +export default web; \ No newline at end of file diff --git a/api/device-define/car.json b/api/device-define/car.json index a832561a64d..41a4eb36fee 100644 --- a/api/device-define/car.json +++ b/api/device-define/car.json @@ -122,6 +122,7 @@ "SystemCapability.Applications.ContactsData", "SystemCapability.Applications.Contacts", "SystemCapability.Applications.settings.Core", - "SystemCapability.Test.UiTest" + "SystemCapability.Test.UiTest", + "SystemCapability.Web" ] } \ No newline at end of file diff --git a/api/device-define/default.json b/api/device-define/default.json index 121cdf64cd4..e9519ff8415 100644 --- a/api/device-define/default.json +++ b/api/device-define/default.json @@ -151,6 +151,7 @@ "SystemCapability.Applications.ContactsData", "SystemCapability.Applications.Contacts", "SystemCapability.Applications.settings.Core", - "SystemCapability.Test.UiTest" + "SystemCapability.Test.UiTest", + "SystemCapability.Web" ] } diff --git a/api/device-define/tablet.json b/api/device-define/tablet.json index c8d305174e4..d447d9ba67d 100644 --- a/api/device-define/tablet.json +++ b/api/device-define/tablet.json @@ -150,6 +150,7 @@ "SystemCapability.Applications.ContactsData", "SystemCapability.Applications.Contacts", "SystemCapability.Applications.settings.Core", - "SystemCapability.Test.UiTest" + "SystemCapability.Test.UiTest", + "SystemCapability.Web" ] } \ No newline at end of file diff --git a/api/device-define/tv.json b/api/device-define/tv.json index c992e8cd632..e0d2755f119 100644 --- a/api/device-define/tv.json +++ b/api/device-define/tv.json @@ -125,6 +125,7 @@ "SystemCapability.Ability.AbilityTools.AbilityAssistant", "SystemCapability.Ability.Form", "SystemCapability.Ability.DistributedAbilityManager", - "SystemCapability.Applications.settings.Core" + "SystemCapability.Applications.settings.Core", + "SystemCapability.Web" ] } \ No newline at end of file diff --git a/api/device-define/wearable.json b/api/device-define/wearable.json index d312e0ae008..8c9289e4bc5 100644 --- a/api/device-define/wearable.json +++ b/api/device-define/wearable.json @@ -127,6 +127,7 @@ "SystemCapability.Ability.DistributedAbilityManager", "SystemCapability.Applications.ContactsData", "SystemCapability.Applications.Contacts", - "SystemCapability.Applications.settings.Core" + "SystemCapability.Applications.settings.Core", + "SystemCapability.Web" ] } \ No newline at end of file -- Gitee