add ui extension component sdk-api

Signed-off-by: liyujie <liyujie43@huawei.com>
Change-Id: I75f1bb0fc84876ffb8900c02506b8c49441c1f81
This commit is contained in:
liyujie 2023-03-29 20:46:21 +08:00
parent b643e4d5be
commit 966a3bf35c
2 changed files with 105 additions and 1 deletions

View File

@ -0,0 +1,103 @@
/*
* Copyright (c) 2023 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.
*/
/**
* Provide an interface for the ui extension component
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @since 10
*/
interface UIExtensionComponentInterface {
/**
* Construct the ui extension component.
* Called when the ui extension component is used.
* @param { string } action - indicates implicit query fields of the UIExtensionAbility
* @param { { [key: string]: any } } parameters - indicates info of the UIExtensionAbility
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @returns { UIExtensionComponentAttribute }
* @since 10
*/
(action: string, parameters?: { [key: string]: any }): UIExtensionComponentAttribute;
}
/**
* Define the attribute functions of ui extension component.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @since 10
*/
declare class UIExtensionComponentAttribute extends CommonMethod<UIExtensionComponentAttribute> {
/**
* Called when the component is connected to ability.
* @param { () => void } Callback function when UIExtensionAbility connects successfully
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @returns { UIExtensionComponentAttribute }
* @since 10
*/
onConnected(callback: () => void): UIExtensionComponentAttribute;
/**
* Called when the component is disconnected.
* @param { () => void } - Callback function when UIExtensionAbility disconnects
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @returns { UIExtensionComponentAttribute }
* @since 10
*/
onDisconnected(callback: () => void): UIExtensionComponentAttribute;
/**
* Called when the provider sends data
* @param { (info: {code: number, want?: import('../api/@ohos.app.ability.Want').default}) => void } indicates info of the UIExtensionAbility
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @returns { UIExtensionComponentAttribute }
* @since 10
*/
onResult(callback: (info: {
code: number, want?: import('../api/@ohos.app.ability.Want').default
}) => void): UIExtensionComponentAttribute
/**
* Called when loading failed, takes the error messages as input parameter
* @param { (info: {errCode: number, errMsg: string}) => void } indicates info of the UIExtensionAbility
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @returns { UIExtensionComponentAttribute }
* @since 10
*/
onError(callback: (info: {
errCode: number, errMsg: string
}) => void): UIExtensionComponentAttribute
}
/**
* Defines UIExtensionComponent Component.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @since 10
*/
declare const UIExtensionComponent: UIExtensionComponentInterface;
/**
* Defines UIExtensionComponent Component instance.
* @syscap SystemCapability.ArkUI.ArkUI.Full
* @systemapi
* @since 10
*/
declare const UIExtensionComponentInstance: UIExtensionComponentAttribute;

View File

@ -16,7 +16,8 @@
"calendar.d.ts",
"form_component.d.ts",
"plugin_component.d.ts",
"remote_window.d.ts"
"remote_window.d.ts",
"ui_extension_component.d.ts"
]
},
"internal_lite": {