• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21
22/**
23 * Provide an interface for the EmbeddedComponent, which is used
24 * <br/>to render UI asynchronously
25 *
26 * @interface EmbeddedComponentInterface
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @atomicservice
29 * @since 12
30 */
31interface EmbeddedComponentInterface {
32  /**
33   * Construct the EmbeddedComponent.<br/>
34   * Called when the EmbeddedComponent is used.
35   *
36   * @param { import('../api/@ohos.app.ability.Want').default } loader - indicates initialization parameter
37   * @param { EmbeddedType } type - indicates type of the EmbeddedComponent
38   * @returns { EmbeddedComponentAttribute }
39   * @syscap SystemCapability.ArkUI.ArkUI.Full
40   * @atomicservice
41   * @since 12
42   */
43  (
44    loader: import('../api/@ohos.app.ability.Want').default,
45    type: EmbeddedType
46  ): EmbeddedComponentAttribute;
47}
48
49/**
50 * Indicates the information when the provider of the embedded UI is terminated.
51 *
52 * @interface TerminationInfo
53 * @syscap SystemCapability.ArkUI.ArkUI.Full
54 * @atomicservice
55 * @since 12
56 */
57declare interface TerminationInfo {
58  /**
59   * Defines the termination code.
60   *
61   * @type { number }
62   * @syscap SystemCapability.ArkUI.ArkUI.Full
63   * @atomicservice
64   * @since 12
65   */
66   code: number;
67
68  /**
69   * Defines the additional termination information.
70   *
71   * @type { ?import('../api/@ohos.app.ability.Want').default }
72   * @syscap SystemCapability.ArkUI.ArkUI.Full
73   * @atomicservice
74   * @since 12
75   */
76   want?: import('../api/@ohos.app.ability.Want').default;
77}
78
79/**
80 * Define the attribute functions of EmbeddedComponent.
81 *
82 * @extends CommonMethod<EmbeddedComponentAttribute>
83 * @syscap SystemCapability.ArkUI.ArkUI.Full
84 * @atomicservice
85 * @since 12
86 */
87declare class EmbeddedComponentAttribute extends CommonMethod<EmbeddedComponentAttribute> {
88  /**
89   * Called when the provider of the embedded UI is terminated.
90   *
91   * @param { import('../api/@ohos.base').Callback<TerminationInfo> } callback
92   * @returns { EmbeddedComponentAttribute }
93   * @syscap SystemCapability.ArkUI.ArkUI.Full
94   * @atomicservice
95   * @since 12
96   */
97  onTerminated(callback: import('../api/@ohos.base').Callback<TerminationInfo>): EmbeddedComponentAttribute;
98
99  /**
100   * Called when some error occurred.
101   *
102   * @param { import('../api/@ohos.base').ErrorCallback } callback
103   * @returns { EmbeddedComponentAttribute }
104   * @syscap SystemCapability.ArkUI.ArkUI.Full
105   * @atomicservice
106   * @since 12
107   */
108  onError(callback: import('../api/@ohos.base').ErrorCallback): EmbeddedComponentAttribute;
109}
110
111/**
112 * Defines EmbeddedComponent Component.
113 *
114 * @syscap SystemCapability.ArkUI.ArkUI.Full
115 * @atomicservice
116 * @since 12
117 */
118declare const EmbeddedComponent: EmbeddedComponentInterface;
119
120/**
121 * Defines EmbeddedComponent Component instance.
122 *
123 * @syscap SystemCapability.ArkUI.ArkUI.Full
124 * @atomicservice
125 * @since 12
126 */
127declare const EmbeddedComponentInstance: EmbeddedComponentAttribute;
128