adjust interface structure

Signed-off-by: houhaoyu <houhaoyu@huawei.com>
Change-Id: Ia2a611651903abdecfc14e1ffee0e89d2b863020
This commit is contained in:
houhaoyu 2022-03-16 10:39:37 +08:00
parent 6c6e520a84
commit cb8479870a
23 changed files with 36 additions and 770 deletions

View File

@ -163,10 +163,11 @@ ohos_declaration_template("ohos_declaration_common") {
ohos_copy("internal_full") {
sources = [
"api/common/@internal/console.d.ts",
"api/common/@internal/global.d.ts",
"api/common/@internal/index.d.ts",
"api/common/@internal/viewmodel.d.ts",
"api/common/full/console.d.ts",
"api/common/full/dom.d.ts",
"api/common/full/global.d.ts",
"api/common/full/index.d.ts",
"api/common/full/viewmodel.d.ts",
]
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
module_source_dir = target_out_dir + "/$target_name"
@ -175,10 +176,10 @@ ohos_copy("internal_full") {
ohos_copy("internal_lite") {
sources = [
"api/liteWearable/@internal/console.d.ts",
"api/liteWearable/@internal/global.d.ts",
"api/liteWearable/@internal/index.d.ts",
"api/liteWearable/@internal/viewmodel.d.ts",
"api/common/lite/console.d.ts",
"api/common/lite/global.d.ts",
"api/common/lite/index.d.ts",
"api/common/lite/viewmodel.d.ts",
]
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
module_source_dir = target_out_dir + "/$target_name"
@ -194,13 +195,13 @@ ohos_copy("syscap_check") {
ohos_copy("system_api") {
sources = [
"api/common/@system.app.d.ts",
"api/common/@system.cipher.d.ts",
"api/common/@system.configuration.d.ts",
"api/common/@system.file.d.ts",
"api/common/@system.mediaquery.d.ts",
"api/common/@system.prompt.d.ts",
"api/common/@system.router.d.ts",
"api/@system.app.d.ts",
"api/@system.cipher.d.ts",
"api/@system.configuration.d.ts",
"api/@system.file.d.ts",
"api/@system.mediaquery.d.ts",
"api/@system.prompt.d.ts",
"api/@system.router.d.ts",
]
outputs = [ target_out_dir + "/$target_name/{{source_file_part}}" ]
module_source_dir = target_out_dir + "/$target_name"

View File

@ -155,6 +155,10 @@ export interface DisableAlertBeforeBackPageOptions {
complete?: () => void;
}
type ParamsInterface = {
[key: string]: Object;
};
/**
* Defines the Router interface.
* @syscap SystemCapability.ArkUI.ArkUI.Lite
@ -191,7 +195,7 @@ export default class Router {
* @returns Page params.
* @since 7
*/
static getParams(): Object;
static getParams(): ParamsInterface;
/**
* Clears all historical pages and retains only the current page at the top of the stack.

View File

@ -14,7 +14,7 @@
*/
/**
* @syscap SystemCapability.ArkUI.ArkUI.Lite
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @since 3
*/
export declare class console {

View File

@ -53,7 +53,7 @@ export declare function cancelAnimationFrame(requestId: number): void;
/**
* Cancels the interval set by " setInterval()".
* @syscap SystemCapability.ArkUI.ArkUI.Lite
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @param intervalID Indicates the timer ID returned by "setInterval()".
* @since 3
*/
@ -61,7 +61,7 @@ export declare function clearInterval(intervalID?: number): void;
/**
* Cancels the timer set by "setTimeout()".
* @syscap SystemCapability.ArkUI.ArkUI.Lite
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @param timeoutID Indicates the timer ID returned by "setTimeout()".
* @since 3
*/

View File

@ -60,3 +60,9 @@ export declare const STANDARD: string;
* Conditional compilation for lite equipment
*/
export declare const LITE: string;
/**
* Defining syscap function.
* @since 8
*/
export declare function canIUse(syscap: string): boolean;

View File

@ -1,81 +0,0 @@
/*
* Copyright (c) 2020 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.
*/
export interface AppResponse {
/**
* Application name
* @since 3
*/
appName: string;
/**
* Application version name
* @since 3
*/
versionName: string;
/**
* Application version
* @since 3
*/
versionCode: number;
}
export interface ScreenOnVisibleOptions {
/**
* Whether to keep the application visible. The default value is false.
* @since 3
*/
visible?: boolean;
/**
* Called when the application always keeps visible.
* @since 3
*/
success?: () => void;
/**
* Called when the application fails to keep visible.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}
/**
* @syscap SystemCapability.ArkUI.ArkUI.Lite
*/
export default class App {
/**
* Obtains the declared information in the config.json file of an application.
*/
static getInfo(): AppResponse;
/**
* Destroys the current ability.
*/
static terminate(): void;
/**
* Keeps the application visible after the screen is woken up.
* This method prevents the system from returning to the home screen when the screen is locked.
*/
static screenOnVisible(options?: ScreenOnVisibleOptions): void;
}

View File

@ -1,46 +0,0 @@
/*
* Copyright (c) 2020 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.
*/
export interface LocaleResponse {
/**
* Current language of the application. Example: zh.
* @since 3
*/
language: string;
/**
* Country or region. Example: CN
* @since 3
*/
countryOrRegion: string;
/**
* Text layout direction. Available values are as follows:
* 1. ltr: The text direction is from left to right.
* 2. rtl: The text direction is from right to left.
* @since 3
*/
dir: "ltr" | "rtl";
}
/**
* @Syscap SysCap.ACE.UIEngineLite
*/
export default class Configuration {
/**
* Obtains the current locale of the application, which is the same as the system locale.
*/
static getLocale(): LocaleResponse;
}

View File

@ -1,570 +0,0 @@
/*
* Copyright (c) 2020 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.
*/
export interface FileResponse {
/**
* File URI.
* @since 3
*/
uri: string;
/**
* File size, in bytes.
* If type is dir, the length value is fixed to 0.
* @since 3
*/
length: number;
/**
* Timestamp when the file is stored, which is the number of milliseconds elapsed since 1970/01/01 00:00:00 GMT.
* For lite wearables, the value is fixed to 0, because this parameter is restricted by the underlying file system.
* @since 3
*/
lastModifiedTime: number;
/**
* File type. Available values are as follows:
* dir: directory
* file: file
* @since 3
*/
type: "dir" | "file";
/**
* File list.
* When the recursive value is true and the type is dir, the file information under the subdirectory will be returned.
* Otherwise, no value will be returned.
* @since 3
*/
subFiles?: Array<FileResponse>;
}
/**
* @Syscap SysCap.ACE.UIEngineLite
*/
export default class File {
/**
* Moves a specified file to a given location.
* @param options Options.
*/
static move(options: {
/**
* URI of the file to move.
* Restricted by the underlying file system of lite wearabless, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
srcUri: string;
/**
* URI of the location to which the file is to move.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
dstUri: string;
/**
* Called when the source file is moved to the specified location successfully.
* This function returns the URI of the file moved to the target location.
* @since 3
*/
success?: (uri: string) => void;
/**
* Called when moving fails.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Copies a file and save the copy to a specified location.
* @param options Options.
*/
static copy(options: {
/**
* URI of the file to copy.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
srcUri: string;
/**
* URI of the location to which the copy is to save.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
dstUri: string;
/**
* Called when the source file is copied and saved to the specified location successfully.
* This function returns the URI of the file saved to the target location.
* @since 3
*/
success?: (uri: string) => void;
/**
* Called when the copy or save operation fails.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Obtains the list of all files in a specified directory.
* @param options Options.
*/
static list(options: {
/**
* URI of the directory.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
uri: string;
/**
* Called when the list is obtained successfully.
* @since 3
*/
success?: (data: { fileList: Array<FileResponse> }) => void;
/**
* Called when the list fails to be obtained.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Obtains information about a specified local file.
* @param options Options.
*/
static get(options: {
/**
* File URI, which cannot be an application resource path.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
uri: string;
/**
* Whether to recursively obtain the file list under a subdirectory.
* The default value is false.
* @since 3
*/
recursive?: boolean;
/**
* Called when file information is obtained successfully.
* @since 3
*/
success?: (file: FileResponse) => void;
/**
* Called when file information fails to be obtained.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Deletes a local file.
* @param options Options.
*/
static delete(options: {
/**
* URI of the file to be deleted, which cannot be an application resource path.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
uri: string;
/**
* Called when local files are deleted successfully.
* @since 3
*/
success?: () => void;
/**
* Called when the deletion fails.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Writes texts into a specified file.
* @param options Options.
*/
static writeText(options: {
/**
* URI of a local file. If it does not exist, a file will be created.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
uri: string;
/**
* Character string to write into the local file.
* @since 3
*/
text: string;
/**
* Encoding format. The default format is UTF-8.
* Currently, only UTF-8 is supported.
* @since 3
*/
encoding?: string;
/**
* Whether to enable the append mode.
* The default value is false.
* @since 3
*/
append?: boolean;
/**
* Called when texts are written into a file successfully.
* @since 3
*/
success?: () => void;
/**
* Called when texts fail to be written into a file.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Reads texts from a specified file.
* @param options Options.
*/
static readText(options: {
/**
* URI of a local file.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
uri: string;
/**
* Encoding format. The default format is UTF-8.
* Currently, only UTF-8 is supported.
* @since 3
*/
encoding?: string;
/**
* Position where the reading starts.
* The default value is the start position of the file.
* @since 3
*/
position?: number;
/**
* Position where the reading starts.
* The default value is the start position of the file.
* @since 3
*/
length?: number;
/**
* Called when texts are read successfully.
* @since 3
*/
success?: (data: { text: string }) => void;
/**
* Called when texts fail to be read.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Writes buffer data into a specified file.
* @param options Options.
*/
static writeArrayBuffer(options: {
/**
* URI of a local file. If it does not exist, a file will be created.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
uri: string;
/**
* Buffer from which the data is derived.
* @since 3
*/
buffer: Uint8Array;
/**
* Offset to the position where the writing starts.
* The default value is 0.
* @since 3
*/
position?: number;
/**
* Whether to enable the append mode. The default value is false.
* If the value is true, the position parameter will become invalid.
* @since 3
*/
append?: boolean;
/**
* Called when data from a buffer is written into a file successfully.
* @since 3
*/
success?: () => void;
/**
* Called when data from a buffer fails to be written into a file.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Reads buffer data from a specified file.
* @param options Options.
*/
static readArrayBuffer(options: {
/**
* URI of a local file.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
uri: string;
/**
* Position where the reading starts.
* The default value is the start position of the file.
* @since 3
*/
position?: number;
/**
* Length of the content to read.
* If this parameter is not set, all content of the file will be read.
* @since 3
*/
length?: number;
/**
* Called when the buffer data is read successfully.
* @since 3
*/
success?: (data: { buffer: Uint8Array }) => void;
/**
* Called when the buffer data fails to be read.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Checks whether a specified file or directory exists.
* @param options Options.
*/
static access(options: {
/**
* URI of the directory or file.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
uri: string;
/**
* Called when the check result is obtained successfully.
* @since 3
*/
success?: () => void;
/**
* Called when the check fails.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Create a specified directory.
* @param options Options.
*/
static mkdir(options: {
/**
* URI of the directory.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* 3. A maximum of five recursions are allowed for creating the directory.
* @since 3
*/
uri: string;
/**
* Whether to recursively create upper-level directories of the specified directory.
* The default value is false.
* @since 3
*/
recursive?: boolean;
/**
* Called when the directory is created successfully.
* @since 3
*/
success?: () => void;
/**
* Called when the creation fails.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
/**
* Deletes a specified directory.
* @param options Options.
*/
static rmdir(options: {
/**
* URI of the directory.
* Restricted by the underlying file system of lite wearables, the value must meet the following requirements:
* 1. The URI cannot contain special characters such as \/"*+,:;<=>?[]|\x7F.
* 2. The maximum number of characters allowed is 128.
* @since 3
*/
uri: string;
/**
* Whether to recursively delete sub files and subdirectories of the specified directory.
* The default value is false.
* @since 3
*/
recursive?: boolean;
/**
* Called when the directory is deleted successfully.
* @since 3
*/
success?: () => void;
/**
* Called when the deletion fails.
* @since 3
*/
fail?: (data: string, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void;
}

View File

@ -1,47 +0,0 @@
/*
* Copyright (c) 2020 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.
*/
export interface RouterOptions {
/**
* URI of the destination page, which supports the following formats:
* 1. Absolute path of the page, which is provided by the pages list in the config.json file.
* Example:
* a. pages/index/index
* b. pages/detail/detail
* 2. Particular path. If the URI is a slash (/), the home page is displayed.
* @since 3
*/
uri: string;
/**
* Data that needs to be passed to the destination page during navigation.
* After the destination page is displayed, the parameter can be directly used for the page.
* For example, this.data1 (data1 is the key value of the params used for page navigation.)
* @since 3
*/
params?: object;
}
/**
* @syscap SystemCapability.ArkUI.ArkUI.Lite
*/
export default class Router {
/**
* Replaces the current page with another one in the application.
* The current page is destroyed after replacement.
* @param route route options.
*/
static replace(route: RouterOptions): void;
}

View File

@ -12,11 +12,10 @@
# limitations under the License.
common_api_src = [
"//interface/sdk-js/api/@ohos.wifi.d.ts",
"//interface/sdk-js/api/common/@system.app.d.ts",
"//interface/sdk-js/api/common/@system.configuration.d.ts",
"//interface/sdk-js/api/common/@system.file.d.ts",
"//interface/sdk-js/api/common/@system.mediaquery.d.ts",
"//interface/sdk-js/api/common/@system.prompt.d.ts",
"//interface/sdk-js/api/common/@system.router.d.ts",
"//interface/sdk-js/api/@system.app.d.ts",
"//interface/sdk-js/api/@system.configuration.d.ts",
"//interface/sdk-js/api/@system.file.d.ts",
"//interface/sdk-js/api/@system.mediaquery.d.ts",
"//interface/sdk-js/api/@system.prompt.d.ts",
"//interface/sdk-js/api/@system.router.d.ts",
]