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