• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 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/*** if arkts 1.2 */
22import { CommonMethod } from './common'
23import { VoidCallback } from './units'
24/*** endif */
25
26/**
27 * PluginComponentTemplate
28 *
29 * @interface PluginComponentTemplate
30 * @syscap SystemCapability.ArkUI.ArkUI.Full
31 * @systemapi
32 * @since arkts {'1.1':'9','1.2':'20'}
33 * @arkts 1.1&1.2
34 */
35interface PluginComponentTemplate {
36  /**
37   * Defines the plugin source name.
38   *
39   * @type { string }
40   * @syscap SystemCapability.ArkUI.ArkUI.Full
41   * @systemapi
42   * @since arkts {'1.1':'9','1.2':'20'}
43   * @arkts 1.1&1.2
44   */
45  source: string;
46  /**
47   * Defines the bundle name of the Template.
48   *
49   * @type { string }
50   * @syscap SystemCapability.ArkUI.ArkUI.Full
51   * @systemapi
52   * @since arkts {'1.1':'9','1.2':'20'}
53   * @arkts 1.1&1.2
54   */
55  bundleName: string;
56}
57
58/**
59 * Define options used to construct a plugin component.
60 * AnonyMous Object Rectification
61 *
62 * @interface PluginComponentOptions
63 * @syscap SystemCapability.ArkUI.ArkUI.Full
64 * @systemapi
65 * @since arkts {'1.1':'18','1.2':'20'}
66 * @arkts 1.1&1.2
67 */
68declare interface PluginComponentOptions {
69  /**
70   * Plugin component template.
71   * @type { PluginComponentTemplate }
72   * @syscap SystemCapability.ArkUI.ArkUI.Full
73   * @systemapi
74   * @since 9
75   */
76  /**
77   * Plugin component template.
78   * AnonyMous Object Rectification
79   * @type { PluginComponentTemplate }
80   * @syscap SystemCapability.ArkUI.ArkUI.Full
81   * @systemapi
82   * @since arkts {'1.1':'18','1.2':'20'}
83   * @arkts 1.1&1.2
84   */
85  template: PluginComponentTemplate;
86
87  /**
88   * Plugin component data.
89   * @type { any }
90   * @syscap SystemCapability.ArkUI.ArkUI.Full
91   * @systemapi
92   * @since 9
93   */
94  /**
95   * Plugin component data.
96   * AnonyMous Object Rectification
97   * @type { any }
98   * @syscap SystemCapability.ArkUI.ArkUI.Full
99   * @systemapi
100   * @since 18
101   */
102  data: any;
103  /**
104   * Plugin component data.
105   * AnonyMous Object Rectification
106   * @type { Object|undefined|null }
107   * @syscap SystemCapability.ArkUI.ArkUI.Full
108   * @systemapi
109   * @since 20
110   * @arkts 1.2
111   */
112  data: Object|undefined|null;
113}
114
115/**
116 * Data provided when an error occurs.
117 * AnonyMous Object Rectification
118 *
119 * @interface PluginErrorData
120 * @syscap SystemCapability.ArkUI.ArkUI.Full
121 * @systemapi
122 * @since arkts {'1.1':'18','1.2':'20'}
123 * @arkts 1.1&1.2
124 */
125declare interface PluginErrorData {
126  /**
127   * Error code.
128   * @type { number }
129   * @syscap SystemCapability.ArkUI.ArkUI.Full
130   * @systemapi
131   * @since 9
132   */
133  /**
134   * Error code.
135   * AnonyMous Object Rectification
136   * @type { number }
137   * @syscap SystemCapability.ArkUI.ArkUI.Full
138   * @systemapi
139   * @since arkts {'1.1':'18','1.2':'20'}
140   * @arkts 1.1&1.2
141   */
142  errcode: number;
143
144  /**
145   * Error message.
146   * @type { string }
147   * @syscap SystemCapability.ArkUI.ArkUI.Full
148   * @systemapi
149   * @since 9
150   */
151  /**
152   * Error message.
153   * AnonyMous Object Rectification
154   * @type { string }
155   * @syscap SystemCapability.ArkUI.ArkUI.Full
156   * @systemapi
157   * @since arkts {'1.1':'18','1.2':'20'}
158   * @arkts 1.1&1.2
159   */
160  msg: string;
161}
162
163/**
164 * Callback invoked when an error occurs.
165 * AnonyMous Object Rectification
166 *
167 * @typedef { function } PluginErrorCallback
168 * @param { PluginErrorData } info - Plugin error data
169 * @syscap SystemCapability.ArkUI.ArkUI.Full
170 * @systemapi
171 * @since arkts {'1.1':'18','1.2':'20'}
172 * @arkts 1.1&1.2
173 */
174declare type PluginErrorCallback = (info: PluginErrorData) => void;
175
176/**
177 * Provides plugin component.
178 *
179 * @interface PluginComponentInterface
180 * @syscap SystemCapability.ArkUI.ArkUI.Full
181 * @systemapi
182 * @since arkts {'1.1':'9','1.2':'20'}
183 * @arkts 1.1&1.2
184 */
185interface PluginComponentInterface {
186  /**
187   * Called when setting the plugin.
188   *
189   * @param { object } value
190   * @returns { PluginComponentAttribute }
191   * @syscap SystemCapability.ArkUI.ArkUI.Full
192   * @systemapi
193   * @since 9
194   */
195  /**
196   * Called when setting the plugin.
197   * AnonyMous Object Rectification
198   *
199   * @param { PluginComponentOptions } options - Plugin component options
200   * @returns { PluginComponentAttribute }
201   * @syscap SystemCapability.ArkUI.ArkUI.Full
202   * @systemapi
203   * @since arkts {'1.1':'18','1.2':'20'}
204   * @arkts 1.1&1.2
205   */
206  (options: PluginComponentOptions): PluginComponentAttribute;
207}
208
209/**
210 * Defines the plugin component attribute functions.
211 *
212 * @extends CommonMethod<PluginComponentAttribute>
213 * @syscap SystemCapability.ArkUI.ArkUI.Full
214 * @systemapi
215 * @since arkts {'1.1':'9','1.2':'20'}
216 * @arkts 1.1&1.2
217 */
218declare class PluginComponentAttribute extends CommonMethod<PluginComponentAttribute> {
219  /**
220   * pluginComponent onComplete callback,
221   *
222   * @param { function } callback
223   * @returns { PluginComponentAttribute }
224   * @syscap SystemCapability.ArkUI.ArkUI.Full
225   * @systemapi
226   * @since 9
227   */
228  /**
229   * PluginComponent onComplete callback
230   * AnonyMous Object Rectification
231   *
232   * @param { VoidCallback } callback
233   * @returns { PluginComponentAttribute }
234   * @syscap SystemCapability.ArkUI.ArkUI.Full
235   * @systemapi
236   * @since arkts {'1.1':'18','1.2':'20'}
237   * @arkts 1.1&1.2
238   */
239  onComplete(callback: VoidCallback): PluginComponentAttribute;
240
241  /**
242   * pluginComponent onError callback,
243   *
244   * @param { function } callback
245   * @returns { PluginComponentAttribute }
246   * @syscap SystemCapability.ArkUI.ArkUI.Full
247   * @systemapi
248   * @since 9
249   */
250  /**
251   * PluginComponent onError callback
252   * AnonyMous Object Rectification
253   *
254   * @param { PluginErrorCallback } callback
255   * @returns { PluginComponentAttribute }
256   * @syscap SystemCapability.ArkUI.ArkUI.Full
257   * @systemapi
258   * @since arkts {'1.1':'18','1.2':'20'}
259   * @arkts 1.1&1.2
260   */
261  onError(callback: PluginErrorCallback): PluginComponentAttribute;
262}
263
264/**
265 * Defines PluginComponent Component.
266 *
267 * @syscap SystemCapability.ArkUI.ArkUI.Full
268 * @systemapi
269 * @since 9
270 */
271declare const PluginComponent: PluginComponentInterface;
272
273/**
274 * Defines PluginComponent Component instance.
275 *
276 * @syscap SystemCapability.ArkUI.ArkUI.Full
277 * @systemapi
278 * @since 9
279 */
280declare const PluginComponentInstance: PluginComponentAttribute;
281