• 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 Defines the isolated component
18 * @kit ArkUI
19 */
20
21/**
22 * Indicates restricted worker for run abc.
23 *
24 * @typedef { import('../api/@ohos.worker').default.RestrictedWorker } RestrictedWorker
25 * @syscap SystemCapability.ArkUI.ArkUI.Full
26 * @systemapi
27 * @since 12
28 */
29declare type RestrictedWorker = import('../api/@ohos.worker').default.RestrictedWorker;
30
31/**
32 * Indicates error callback.
33 *
34 * @typedef { import('../api/@ohos.base').ErrorCallback } ErrorCallback
35 * @syscap SystemCapability.ArkUI.ArkUI.Full
36 * @systemapi
37 * @since 12
38 */
39declare type ErrorCallback = import('../api/@ohos.base').ErrorCallback;
40
41/**
42 * Indicates want.
43 *
44 * @typedef { import('../api/@ohos.app.ability.Want').default } Want
45 * @syscap SystemCapability.ArkUI.ArkUI.Full
46 * @systemapi
47 * @since 12
48 */
49declare type Want = import('../api/@ohos.app.ability.Want').default;
50
51/**
52 * This interface is used to set the options for IsolatedComponentAttribute during construction
53 *
54 * @interface IsolatedOptions
55 * @syscap SystemCapability.ArkUI.ArkUI.Full
56 * @systemapi
57 * @since 12
58 */
59declare interface IsolatedOptions {
60  /**
61   * Indicates want of the IsolatedOptions.
62   * @type { Want }
63   * @syscap SystemCapability.ArkUI.ArkUI.Full
64   * @systemapi
65   * @since 12
66   */
67  want: Want;
68  /**
69   * Indicates restricted worker for run abc.
70   * @type { RestrictedWorker } worker - worker which run abc
71   * @syscap SystemCapability.ArkUI.ArkUI.Full
72   * @systemapi
73   * @since 12
74   */
75  worker: RestrictedWorker;
76}
77
78/**
79 * Provide an interface for the IsolatedComponent, which is used to render UI of other ABC
80 *
81 * @typedef { function } IsolatedComponentInterface
82 * @param { IsolatedOptions } options - Construction configuration of IsolatedComponentAttribute
83 * @returns { IsolatedComponentAttribute } Attribute of IsolatedComponent
84 * @syscap SystemCapability.ArkUI.ArkUI.Full
85 * @systemapi
86 * @since 12
87 */
88declare type IsolatedComponentInterface = (options: IsolatedOptions) => IsolatedComponentAttribute;
89
90/**
91 * Define the attribute functions of IsolatedComponent.
92 *
93 * @extends CommonMethod<IsolatedComponentAttribute>
94 * @syscap SystemCapability.ArkUI.ArkUI.Full
95 * @systemapi
96 * @since 12
97 */
98declare class IsolatedComponentAttribute extends CommonMethod<IsolatedComponentAttribute> {
99  /**
100   * @param { ErrorCallback } callback
101   * - called when some error occurred except disconnected from IsolatedAbility.
102   * @returns { IsolatedComponentAttribute }
103   * @syscap SystemCapability.ArkUI.ArkUI.Full
104   * @systemapi
105   * @since 12
106   */
107  onError(
108    callback: ErrorCallback
109  ): IsolatedComponentAttribute;
110}
111
112/**
113 * Defines IsolatedComponent Component.
114 *
115 * @syscap SystemCapability.ArkUI.ArkUI.Full
116 * @systemapi
117 * @since 12
118 */
119declare const IsolatedComponent: IsolatedComponentInterface;
120
121/**
122 * Defines IsolatedComponent Component instance.
123 *
124 * @syscap SystemCapability.ArkUI.ArkUI.Full
125 * @systemapi
126 * @since 12
127 */
128declare const IsolatedComponentInstance: IsolatedComponentAttribute;
129