The **PluginComponentManager** module provides APIs for the **PluginComponent** user to request components and data and send component templates and data. For details about how to display the **PluginComponent** template, see [PluginComponent](../arkui-ts/ts-basic-components-plugincomponent.md).
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
| want | [Want](js-apis-application-want.md) | Yes | Ability information of the component provider. |
| name | string | Yes | Name of the requested component. |
| data | [KVObject](#kvobject) | Yes | Additional data. |
| jsonPath | string | No | Path to the [external.json](#about-the-externaljson-file) file that stores the template path. Request communication is not triggered when **jsonPath** is not empty or not set.|
### RequestParameterForStage
Sets the parameters to be passed in the **PluginManager.Request** API in the stage model.
**System API**: This is a system API.
**Model restriction**: This API can be used only in the stage model.
| owner | [Want](js-apis-application-want.md) | Yes | Ability information of the component user. |
| target | [Want](js-apis-application-want.md) | Yes | Ability information of the component provider. |
| name | string | Yes | Name of the requested component. |
| data | [KVObject](#kvobject) | Yes | Additional data. |
| jsonPath | string | No | Path to the [external.json](#about-the-externaljson-file) file that stores the template path. Request communication is not triggered when **jsonPath** is not empty or not set.|
### RequestCallbackParameters
Provides the result returned after the **PluginManager.Request** API is called.
Listens for events of the request type and returns the requested data, or listens for events of the push type and receives the data pushed by the provider.
| eventType | string | Yes | Type of the event to listen for. The options are as follows:<br>**"push"**: The component provider pushes data to the component consumer.<br>**"request"**: The component consumer proactively requests data from the component provider. |
| callback | [OnPushEventCallback](#onpusheventcallback)\|[OnRequestEventCallback](#onrequesteventcallback) | Yes | Callback used to return the result. The type is [OnPushEventCallback](#onpusheventcallback) for the push event and [OnRequestEventCallback](#onrequesteventcallback) for the request event.|
The **external.json** file is created by developers. It stores component names and template paths in key-value pairs. The component name is used as the keyword, and the corresponding template path is used as the value.
The **\<PluginComponent>** allows the UI provided by an external application to be displayed in the application.
The **\<PluginComponent>** allows the UI provided by an external application to be displayed in the application. To implement the update through inter-process communication (IPC), see [@ohos.pluginComponent](../apis/js-apis-plugincomponent.md).
> **NOTE**
>
> - This component is supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this component are system APIs.
## Child Components
...
...
@@ -23,166 +20,41 @@ Creates a **PluginComponent** to display the UI provided by an external applicat
| value | {<br>template: PluginComponentTemplate,<br>data: KVObject<br>} | Yes | **template**: template of the **PluginComponent**, which is bound to the component defined by the provider.<br>**data**: data passed to the **PluginComponent** provider.|
| value | {<br>template: [PluginComponentTemplate](#plugincomponenttemplate),<br>data: [KVObject](../apis/js-apis-plugincomponent.md#kvobject)<br>} | Yes | **template**: template of the **PluginComponent**, which is bound to the component defined by the provider.<br>**data**: data passed to the **PluginComponent** provider.|
## PluginComponentTemplate
| Name | Type | Description |
| ------- | ------ | ----------------------- |
| source | string | Component template name. |
| ability | string | Name of the provider ability.|
| param | RequestParameters | Yes | Information about the component request. For details, see **RequestParameters**.|
| callback | AsyncCallback<RequestCallbackParameters \| void> | Yes | Asynchronous callback used to return the requested data. |
**RequestParameters**
| Name | Type | Mandatory | Description |
| ---- | -------- | ---- | --------------- |
| want | Want | Yes | Ability information of the component provider.|
| name | string | Yes | Name of the requested component. |
| data | KVObject | Yes | Additional data. |
| jsonPath | string | No | Path of the **external.json file** that stores template paths. If this parameter is not null or not set, request communication is not triggered. |
Listens for events of the request type and returns the requested data, or listens for events of the push type and receives the data pushed by the provider.
| eventType | string | Yes | Type of the event to listen for The options are as follows:<br>**"push"**: The component provider pushes data to the component user.<br>**"request"**: The component user proactively requests data from the component provider.|
| callback | OnPushEventCallback \| OnRequestEventCallback | Yes | Callback used to return the result. For details, see **callback**. |
| OnRequestEventCallback | (source: Want,<br>name: string,<br>data: KVObject ) =>RequestEventResult | Callback for the data request event.<br>**source**: ability information of the component requester.<br>**name**: name of the requested component.<br>**data**: additional data.<br>Return value: request data and result.|
| OnPushEventCallback | (source: Want,<br>template: PluginComponentTemplate,<br>data: KVObject,<br>extraData: KVObject<br>) => void | Callback used to receive the data pushed by the component provider.<br>**source**: ability information of the component provider.<br>**template**: component template.<br>**data**: component update data.<br>**extraData**: additional data.|
**RequestEventResult**
| Name | Type | Description |
| --------- | -------- | ---------- |
| template | string | Component name.|
| data | KVObject | Component data.|
| extraData | KVObject | Additional data.|
**Example**
For details, see [PluginComponent Tools](#plugincomponent-tools).
| key | number \| string \| boolean \| Array \| KVObject | Key of the **KVObject**. **KVObject** uses **key** and **value** to store data. If **key** is of the string type, **value** can be of the number, string, boolean, array type or another **KVObject**.|
**Description of the external.json file**
The **external.json** file is created by developers. This file stores component names and template paths in key-value pairs. The component name is the key, and the corresponding template path is the value.