提交 845e1951 编写于 作者: Y yanwenhao 提交者: wangkailong

Refine docs of application.formhost.d.ts.

Signed-off-by: Nyanwenhao <yanwenhao9@huawei.com>
Change-Id: Ieedf99a7946863481683094c0a707ebf1bf2d0a7
上级 cf8488a1
......@@ -44,7 +44,7 @@
- [@ohos.application.errorManager (ErrorManager)](js-apis-errorManager.md)
- [@oho.app.form.formBindingData (卡片数据绑定类)](js-apis-app-form-formbindingdata.md)
- [@ohos.application.formError (FormError)](js-apis-formerror.md)
- [@ohos.application.formHost (FormHost)](js-apis-formhost.md)
- [@ohos.app.form.formProvider (FormProvider)](js-apis-app-form-formprovider.md)
- [@ohos.app.form.formInfo (FormInfo)](js-apis-app-form-forminfo.md)
- [@ohos.application.missionManager (missionManager)](js-apis-missionManager.md)
......@@ -294,6 +294,7 @@
- [@ohos.uitest (UiTest)](js-apis-uitest.md)
- 已停止维护的接口
- [@ohos.application.formHost (FormHost)](js-apis-formhost.md)
- [@ohos.application.formProvider (FormProvider)](js-apis-formprovider.md)
- [@ohos.application.formInfo (FormInfo)](js-apis-formInfo.md)
- [@ohos.application.formBindingData (卡片数据绑定类)](js-apis-formbindingdata.md)
......
......@@ -3,9 +3,10 @@
FormHost模块提供了卡片使用方相关接口的能力,包括删除、释放、请求更新卡片,发送通知到指定卡片,获取卡片信息、状态等。
> **说明:**
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块接口均为系统接口,三方应用不支持调用。
>
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 从API version 9 开始不再维护,建议使用[FormHost](js-apis-app-form-formhost.md)替代。
> 本模块接口均为系统接口。
## 导入模块
......@@ -13,17 +14,11 @@ FormHost模块提供了卡片使用方相关接口的能力,包括删除、释
import formHost from '@ohos.application.formHost';
```
## 权限
ohos.permission.REQUIRE_FORM
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
## deleteForm
deleteForm(formId: string, callback: AsyncCallback&lt;void&gt;): void;
deleteForm(formId: string, callback: AsyncCallback&lt;void&gt;): void
删除指定的卡片。调用此方法后,应用程序将无法使用该卡片,卡片管理器服务不再保留有关该卡片的信息。
删除指定的卡片。调用此方法后,应用程序将无法使用该卡片,卡片管理器服务不再保留有关该卡片的信息。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -33,25 +28,25 @@ deleteForm(formId: string, callback: AsyncCallback&lt;void&gt;): void;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formId | string | 是 | 卡片标识 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当删除指定的卡片成功,error为undefined,否则为错误对象 |
**示例:**
```js
var formId = "12400633174999288";
formHost.deleteForm(formId, (error, data) => {
if (error.code) {
console.log('formHost deleteForm, error:' + JSON.stringify(error));
}
});
```
```js
var formId = "12400633174999288";
formHost.deleteForm(formId, (error, data) => {
if (error.code) {
console.log('formHost deleteForm, error:' + JSON.stringify(error));
}
});
```
## deleteForm
deleteForm(formId: string): Promise&lt;void&gt;;
deleteForm(formId: string): Promise&lt;void&gt;
删除指定的卡片。调用此方法后,应用程序将无法使用该卡片,卡片管理器服务不再保留有关该卡片的信息。
删除指定的卡片。调用此方法后,应用程序将无法使用该卡片,卡片管理器服务不再保留有关该卡片的信息。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -59,32 +54,32 @@ deleteForm(formId: string): Promise&lt;void&gt;;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**参数:**
```js
var formId = "12400633174999288";
formHost.deleteForm(formId).then(() => {
console.log('formHost deleteForm success');
}).catch((error) => {
console.log('formHost deleteForm, error:' + JSON.stringify(error));
});
```
```js
var formId = "12400633174999288";
formHost.deleteForm(formId).then(() => {
console.log('formHost deleteForm success');
}).catch((error) => {
console.log('formHost deleteForm, error:' + JSON.stringify(error));
});
```
## releaseForm
releaseForm(formId: string, callback: AsyncCallback&lt;void&gt;): void;
releaseForm(formId: string, callback: AsyncCallback&lt;void&gt;): void
释放指定的卡片。调用此方法后,应用程序将无法使用该卡片,但卡片管理器服务仍然保留有关该卡片的缓存信息和存储信息。
释放指定的卡片。调用此方法后,应用程序将无法使用该卡片,但卡片管理器服务仍然保留有关该卡片的缓存信息和存储信息。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -94,25 +89,25 @@ releaseForm(formId: string, callback: AsyncCallback&lt;void&gt;): void;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formId | string | 是 | 卡片标识 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当释放指定的卡片成功,error为undefined;否则为错误对象。|
**示例:**
```js
var formId = "12400633174999288";
formHost.releaseForm(formId, (error, data) => {
if (error.code) {
console.log('formHost releaseForm, error:' + JSON.stringify(error));
}
});
```
```js
var formId = "12400633174999288";
formHost.releaseForm(formId, (error, data) => {
if (error.code) {
console.log('formHost releaseForm, error:' + JSON.stringify(error));
}
});
```
## releaseForm
releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback&lt;void&gt;): void;
releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback&lt;void&gt;): void
释放指定的卡片。调用此方法后,应用程序将无法使用该卡片,卡片管理器服务保留有关该卡片的存储信息,可以选择是否保留缓存信息。
释放指定的卡片。调用此方法后,应用程序将无法使用该卡片,卡片管理器服务保留有关该卡片的存储信息,可以选择是否保留缓存信息。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -122,26 +117,26 @@ releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback&lt;
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | ----------- |
| formId | string | 是 | 卡片标识 |
| isReleaseCache | boolean | 是 | 是否释放缓存 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formId | string | 是 | 卡片标识 |
| isReleaseCache | boolean | 是 | 是否释放缓存 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当释放指定的卡片成功,error为undefined;否则为错误对象。 |
**示例:**
```js
var formId = "12400633174999288";
formHost.releaseForm(formId, true, (error, data) => {
if (error.code) {
console.log('formHost releaseForm, error:' + JSON.stringify(error));
}
});
```
```js
var formId = "12400633174999288";
formHost.releaseForm(formId, true, (error, data) => {
if (error.code) {
console.log('formHost releaseForm, error:' + JSON.stringify(error));
}
});
```
## releaseForm
releaseForm(formId: string, isReleaseCache?: boolean): Promise&lt;void&gt;;
releaseForm(formId: string, isReleaseCache?: boolean): Promise&lt;void&gt;
释放指定的卡片。调用此方法后,应用程序将无法使用该卡片,卡片管理器服务保留有关该卡片的存储信息,可以选择是否保留缓存信息。
释放指定的卡片。调用此方法后,应用程序将无法使用该卡片,卡片管理器服务保留有关该卡片的存储信息,可以选择是否保留缓存信息。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -149,33 +144,33 @@ releaseForm(formId: string, isReleaseCache?: boolean): Promise&lt;void&gt;;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | ----------- |
| formId | string | 是 | 卡片标识 |
| isReleaseCache | boolean | 否 | 是否释放缓存 |
| 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | ----------- |
| formId | string | 是 | 卡片标识。 |
| isReleaseCache | boolean | 否 | 是否释放缓存。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**示例:**
```js
var formId = "12400633174999288";
formHost.releaseForm(formId, true).then(() => {
console.log('formHost releaseForm success');
}).catch((error) => {
console.log('formHost releaseForm, error:' + JSON.stringify(error));
});
```
```js
var formId = "12400633174999288";
formHost.releaseForm(formId, true).then(() => {
console.log('formHost releaseForm success');
}).catch((error) => {
console.log('formHost releaseForm, error:' + JSON.stringify(error));
});
```
## requestForm
requestForm(formId: string, callback: AsyncCallback&lt;void&gt;): void;
requestForm(formId: string, callback: AsyncCallback&lt;void&gt;): void
请求卡片更新。
请求卡片更新。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -185,25 +180,25 @@ requestForm(formId: string, callback: AsyncCallback&lt;void&gt;): void;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formId | string | 是 | 卡片标识 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当请求卡片更新成功,error为undefined;否则为错误对象。 |
**示例:**
```js
var formId = "12400633174999288";
formHost.requestForm(formId, (error, data) => {
if (error.code) {
console.log('formHost requestForm, error:' + JSON.stringify(error));
}
});
```
```js
var formId = "12400633174999288";
formHost.requestForm(formId, (error, data) => {
if (error.code) {
console.log('formHost requestForm, error:' + JSON.stringify(error));
}
});
```
## requestForm
requestForm(formId: string): Promise&lt;void&gt;;
requestForm(formId: string): Promise&lt;void&gt;
请求卡片更新。
请求卡片更新。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -211,32 +206,32 @@ requestForm(formId: string): Promise&lt;void&gt;;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**示例:**
```js
var formId = "12400633174999288";
formHost.requestForm(formId).then(() => {
console.log('formHost requestForm success');
}).catch((error) => {
console.log('formHost requestForm, error:' + JSON.stringify(error));
});
```
```js
var formId = "12400633174999288";
formHost.requestForm(formId).then(() => {
console.log('formHost requestForm success');
}).catch((error) => {
console.log('formHost requestForm, error:' + JSON.stringify(error));
});
```
## castTempForm
castTempForm(formId: string, callback: AsyncCallback&lt;void&gt;): void;
castTempForm(formId: string, callback: AsyncCallback&lt;void&gt;): void
将指定的临时卡片转换为普通卡片。
将指定的临时卡片转换为普通卡片。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -246,25 +241,25 @@ castTempForm(formId: string, callback: AsyncCallback&lt;void&gt;): void;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formId | string | 是 | 卡片标识 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当将指定的临时卡片转换为普通卡片成功,err为undefined,否则为错误对象。 |
**示例:**
```js
var formId = "12400633174999288";
formHost.castTempForm(formId, (error, data) => {
if (error.code) {
console.log('formHost castTempForm, error:' + JSON.stringify(error));
}
});
```
```js
var formId = "12400633174999288";
formHost.castTempForm(formId, (error, data) => {
if (error.code) {
console.log('formHost castTempForm, error:' + JSON.stringify(error));
}
});
```
## castTempForm
castTempForm(formId: string): Promise&lt;void&gt;;
castTempForm(formId: string): Promise&lt;void&gt;
将指定的临时卡片转换为普通卡片。
将指定的临时卡片转换为普通卡片。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -272,32 +267,32 @@ castTempForm(formId: string): Promise&lt;void&gt;;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。|
**示例:**
```js
var formId = "12400633174999288";
formHost.castTempForm(formId).then(() => {
console.log('formHost castTempForm success');
}).catch((error) => {
console.log('formHost castTempForm, error:' + JSON.stringify(error));
});
```
```js
var formId = "12400633174999288";
formHost.castTempForm(formId).then(() => {
console.log('formHost castTempForm success');
}).catch((error) => {
console.log('formHost castTempForm, error:' + JSON.stringify(error));
});
```
## notifyVisibleForms
notifyVisibleForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void;
notifyVisibleForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void
向卡片框架发送通知以使指定的卡片可见。该方法调用成功后,会调用onVisibilityChange通知卡片提供方。
向卡片框架发送通知以使指定的卡片可见。该方法调用成功后,会调用onVisibilityChange通知卡片提供方。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -307,25 +302,25 @@ notifyVisibleForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当向卡片框架发送通知以使指定的卡片可见成功,err为undefined,否则为错误对象。 |
**示例:**
```js
var formId = ["12400633174999288"];
formHost.notifyVisibleForms(formId, (error, data) => {
if (error.code) {
console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error));
}
});
```
```js
var formId = ["12400633174999288"];
formHost.notifyVisibleForms(formId, (error, data) => {
if (error.code) {
console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error));
}
});
```
## notifyVisibleForms
notifyVisibleForms(formIds: Array&lt;string&gt;): Promise&lt;void&gt;;
notifyVisibleForms(formIds: Array&lt;string&gt;): Promise&lt;void&gt;
向卡片框架发送通知以使指定的卡片可见。该方法调用成功后,会调用onVisibilityChange通知卡片提供方。
向卡片框架发送通知以使指定的卡片可见。该方法调用成功后,会调用onVisibilityChange通知卡片提供方。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -335,30 +330,30 @@ notifyVisibleForms(formIds: Array&lt;string&gt;): Promise&lt;void&gt;;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**示例:**
```js
var formId = ["12400633174999288"];
formHost.notifyVisibleForms(formId).then(() => {
console.log('formHost notifyVisibleForms success');
}).catch((error) => {
console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error));
});
```
```js
var formId = ["12400633174999288"];
formHost.notifyVisibleForms(formId).then(() => {
console.log('formHost notifyVisibleForms success');
}).catch((error) => {
console.log('formHost notifyVisibleForms, error:' + JSON.stringify(error));
});
```
## notifyInvisibleForms
notifyInvisibleForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void;
notifyInvisibleForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void
向卡片框架发送通知以使指定的卡片不可见。该方法调用成功后,会调用onVisibilityChange通知卡片提供方。
向卡片框架发送通知以使指定的卡片不可见。该方法调用成功后,会调用onVisibilityChange通知卡片提供方。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -368,25 +363,25 @@ notifyInvisibleForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;vo
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表|
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当向卡片框架发送通知以使指定的卡片不可见成功,err为undefined,否则为错误对象。 |
**示例:**
```js
var formId = ["12400633174999288"];
formHost.notifyInvisibleForms(formId, (error, data) => {
if (error.code) {
console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error));
}
});
```
```js
var formId = ["12400633174999288"];
formHost.notifyInvisibleForms(formId, (error, data) => {
if (error.code) {
console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error));
}
});
```
## notifyInvisibleForms
notifyInvisibleForms(formIds: Array&lt;string&gt;): Promise&lt;void&gt;;
notifyInvisibleForms(formIds: Array&lt;string&gt;): Promise&lt;void&gt;
向卡片框架发送通知以使指定的卡片不可见。该方法调用成功后,会调用onVisibilityChange通知卡片提供方。
向卡片框架发送通知以使指定的卡片不可见。该方法调用成功后,会调用onVisibilityChange通知卡片提供方。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -396,30 +391,30 @@ notifyInvisibleForms(formIds: Array&lt;string&gt;): Promise&lt;void&gt;;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。|
**示例:**
```js
var formId = ["12400633174999288"];
formHost.notifyInvisibleForms(formId).then(() => {
console.log('formHost notifyInvisibleForms success');
}).catch((error) => {
console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error));
});
```
```js
var formId = ["12400633174999288"];
formHost.notifyInvisibleForms(formId).then(() => {
console.log('formHost notifyInvisibleForms success');
}).catch((error) => {
console.log('formHost notifyInvisibleForms, error:' + JSON.stringify(error));
});
```
## enableFormsUpdate
enableFormsUpdate(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void;
enableFormsUpdate(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void
向卡片框架发送通知以使指定的卡片可以更新。该方法调用成功后,卡片刷新状态设置为使能,卡片可以接收来自卡片提供方的更新。
向卡片框架发送通知以使指定的卡片可以更新。该方法调用成功后,卡片刷新状态设置为使能,卡片可以接收来自卡片提供方的更新。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -429,25 +424,25 @@ enableFormsUpdate(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void&
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当向卡片框架发送通知以使指定的卡片可以更新成功,err为undefined,否则为错误对象。 |
**示例:**
```js
var formId = ["12400633174999288"];
formHost.enableFormsUpdate(formId, (error, data) => {
if (error.code) {
console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error));
}
});
```
```js
var formId = ["12400633174999288"];
formHost.enableFormsUpdate(formId, (error, data) => {
if (error.code) {
console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error));
}
});
```
## enableFormsUpdate
enableFormsUpdate(formIds: Array&lt;string&gt;): Promise&lt;void&gt;;
enableFormsUpdate(formIds: Array&lt;string&gt;): Promise&lt;void&gt;
向卡片框架发送通知以使指定的卡片可以更新。该方法调用成功后,卡片刷新状态设置为使能,卡片可以接收来自卡片提供方的更新。
向卡片框架发送通知以使指定的卡片可以更新。该方法调用成功后,卡片刷新状态设置为使能,卡片可以接收来自卡片提供方的更新。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -457,30 +452,30 @@ enableFormsUpdate(formIds: Array&lt;string&gt;): Promise&lt;void&gt;;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**示例:**
```js
var formId = ["12400633174999288"];
formHost.enableFormsUpdate(formId).then(() => {
console.log('formHost enableFormsUpdate success');
}).catch((error) => {
console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error));
});
```
```js
var formId = ["12400633174999288"];
formHost.enableFormsUpdate(formId).then(() => {
console.log('formHost enableFormsUpdate success');
}).catch((error) => {
console.log('formHost enableFormsUpdate, error:' + JSON.stringify(error));
});
```
## disableFormsUpdate
disableFormsUpdate(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void;
disableFormsUpdate(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void
向卡片框架发送通知以使指定的卡片不可以更新。该方法调用成功后,卡片刷新状态设置为去使能,卡片不可以接收来自卡片提供方的更新。
向卡片框架发送通知以使指定的卡片不可以更新。该方法调用成功后,卡片刷新状态设置为去使能,卡片不可以接收来自卡片提供方的更新。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -490,25 +485,25 @@ disableFormsUpdate(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;void
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当向卡片框架发送通知以使指定的卡片不可以更新成功,err为undefined,否则为错误对象。 |
**示例:**
```js
var formId = ["12400633174999288"];
formHost.disableFormsUpdate(formId, (error, data) => {
if (error.code) {
console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error));
}
});
```
```js
var formId = ["12400633174999288"];
formHost.disableFormsUpdate(formId, (error, data) => {
if (error.code) {
console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error));
}
});
```
## disableFormsUpdate
disableFormsUpdate(formIds: Array&lt;string&gt;): Promise&lt;void&gt;;
disableFormsUpdate(formIds: Array&lt;string&gt;): Promise&lt;void&gt;
向卡片框架发送通知以使指定的卡片不可以更新。该方法调用成功后,卡片刷新状态设置为去使能,卡片不可以接收来自卡片提供方的更新。
向卡片框架发送通知以使指定的卡片不可以更新。该方法调用成功后,卡片刷新状态设置为去使能,卡片不可以接收来自卡片提供方的更新。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -518,30 +513,30 @@ disableFormsUpdate(formIds: Array&lt;string&gt;): Promise&lt;void&gt;;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**示例:**
```js
var formId = ["12400633174999288"];
formHost.disableFormsUpdate(formId).then(() => {
console.log('formHost disableFormsUpdate success');
}).catch((error) => {
console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error));
});
```
```js
var formId = ["12400633174999288"];
formHost.disableFormsUpdate(formId).then(() => {
console.log('formHost disableFormsUpdate success');
}).catch((error) => {
console.log('formHost disableFormsUpdate, error:' + JSON.stringify(error));
});
```
## isSystemReady
isSystemReady(callback: AsyncCallback&lt;void&gt;): void;
isSystemReady(callback: AsyncCallback&lt;void&gt;): void
检查系统是否准备好。
检查系统是否准备好。使用callback异步回调。
**系统能力**:SystemCapability.Ability.Form
......@@ -549,49 +544,49 @@ isSystemReady(callback: AsyncCallback&lt;void&gt;): void;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当检查系统是否准备好成功,err为undefined,否则为错误对象。 |
**示例:**
```js
var formId = "12400633174999288";
formHost.isSystemReady((error, data) => {
if (error.code) {
console.log('formHost isSystemReady, error:' + JSON.stringify(error));
}
});
```
```js
var formId = "12400633174999288";
formHost.isSystemReady((error, data) => {
if (error.code) {
console.log('formHost isSystemReady, error:' + JSON.stringify(error));
}
});
```
## isSystemReady
isSystemReady(): Promise&lt;void&gt;;
isSystemReady(): Promise&lt;void&gt;
检查系统是否准备好。
检查系统是否准备好。使用Promise异步回调。
**系统能力**:SystemCapability.Ability.Form
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**示例:**
```js
var formId = "12400633174999288";
formHost.isSystemReady().then(() => {
console.log('formHost isSystemReady success');
}).catch((error) => {
console.log('formHost isSystemReady, error:' + JSON.stringify(error));
});
```
```js
var formId = "12400633174999288";
formHost.isSystemReady().then(() => {
console.log('formHost isSystemReady success');
}).catch((error) => {
console.log('formHost isSystemReady, error:' + JSON.stringify(error));
});
```
## getAllFormsInfo
getAllFormsInfo(callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
getAllFormsInfo(callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void
获取设备上所有应用提供的卡片信息。
获取设备上所有应用提供的卡片信息。使用callback异步回调。
**需要权限**:ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
......@@ -599,28 +594,27 @@ getAllFormsInfo(callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;):
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | 是 | callback形式返回查询到的卡片信息 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | 是 | 回调函数。当获取设备上所有应用提供的卡片信息成功,err为undefined,data为查询到的卡片信息;否则为错误对象。 |
**示例:**
```js
formHost.getAllFormsInfo((error, data) => {
if (error.code) {
console.log('formHost getAllFormsInfo, error:' + JSON.stringify(error));
} else {
console.log('formHost getAllFormsInfo, data:' + JSON.stringify(data));
}
});
```
```js
formHost.getAllFormsInfo((error, data) => {
if (error.code) {
console.log('formHost getAllFormsInfo, error:' + JSON.stringify(error));
} else {
console.log('formHost getAllFormsInfo, data:' + JSON.stringify(data));
}
});
```
## getAllFormsInfo
getAllFormsInfo(): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;;
getAllFormsInfo(): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;
获取设备上所有应用提供的卡片信息。
获取设备上所有应用提供的卡片信息。使用Promise异步回调。
**需要权限**:ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
......@@ -630,7 +624,7 @@ getAllFormsInfo(): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;;
| 类型 | 说明 |
| :------------ | :---------------------------------- |
| Promise&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Promise实例,用于获取异步返回查询到的卡片信息 |
| Promise&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Promise对象,返回查询到的卡片信息。 |
**示例:**
......@@ -644,10 +638,9 @@ getAllFormsInfo(): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;;
## getFormsInfo
getFormsInfo(bundleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
getFormsInfo(bundleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void
获取设备上指定应用程序提供的卡片信息。
获取设备上指定应用程序提供的卡片信息。使用callback异步回调。
**需要权限**:ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
......@@ -655,29 +648,28 @@ getFormsInfo(bundleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.Fo
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| bundleName | string | 是 | 要查询的应用程序包名称 |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | 是 | callback形式返回查询到的卡片信息 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | 是 | 回调函数。当获取设备上指定应用程序提供的卡片信息成功,err为undefined,data为查询到的卡片信息;否则为错误对象。 |
**示例:**
```js
formHost.getFormsInfo("com.example.ohos.formjsdemo", (error, data) => {
if (error.code) {
console.log('formHost getFormsInfo, error:' + JSON.stringify(error));
} else {
console.log('formHost getFormsInfo, data:' + JSON.stringify(data));
}
});
```
```js
formHost.getFormsInfo("com.example.ohos.formjsdemo", (error, data) => {
if (error.code) {
console.log('formHost getFormsInfo, error:' + JSON.stringify(error));
} else {
console.log('formHost getFormsInfo, data:' + JSON.stringify(data));
}
});
```
## getFormsInfo
getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void;
getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback&lt;Array&lt;formInfo.FormInfo&gt;&gt;): void
获取设备上指定应用程序提供的卡片信息。
获取设备上指定应用程序提供的卡片信息。使用callback异步回调。
**需要权限**:ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
......@@ -685,30 +677,29 @@ getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback&lt;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| bundleName | string | 是 | 要查询的应用程序包名称 |
| moduleName | string | 是 | 要查询的模块名称 |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | 是 | callback形式返回查询到的卡片信息 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| moduleName | string | 是 | 要查询的模块名称。 |
| callback | AsyncCallback&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | 是 | 回调函数。当获取设备上指定应用程序提供的卡片信息成功,err为undefined,data为查询到的卡片信息;否则为错误对象。 |
**示例:**
```js
formHost.getFormsInfo("com.example.ohos.formjsdemo", "entry", (error, data) => {
if (error.code) {
console.log('formHost getFormsInfo, error:' + JSON.stringify(error));
} else {
console.log('formHost getFormsInfo, data:' + JSON.stringify(data));
}
});
```
```js
formHost.getFormsInfo("com.example.ohos.formjsdemo", "entry", (error, data) => {
if (error.code) {
console.log('formHost getFormsInfo, error:' + JSON.stringify(error));
} else {
console.log('formHost getFormsInfo, data:' + JSON.stringify(data));
}
});
```
## getFormsInfo
getFormsInfo(bundleName: string, moduleName?: string): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;;
getFormsInfo(bundleName: string, moduleName?: string): Promise&lt;Array&lt;formInfo.FormInfo&gt;&gt;
获取设备上指定应用程序提供的卡片信息。
获取设备上指定应用程序提供的卡片信息。使用Promise异步回调。
**需要权限**:ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
......@@ -716,32 +707,32 @@ getFormsInfo(bundleName: string, moduleName?: string): Promise&lt;Array&lt;formI
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| bundleName | string | 是 | 要查询的应用程序包名称 |
| moduleName | string | 否 | 要查询的模块名称 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| bundleName | string | 是 | 要查询的应用程序包名称。 |
| moduleName | string | 否 | 要查询的模块名称。 |
**返回值:**
| 类型 | 说明 |
| :------------ | :---------------------------------- |
| Promise&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Promise实例,用于获取异步返回查询到的卡片信息 |
| Promise&lt;Array&lt;[FormInfo](./js-apis-formInfo.md#forminfo-1)&gt;&gt; | Promise对象,返回查询到的卡片信息。 |
**示例:**
```js
formHost.getFormsInfo("com.example.ohos.formjsdemo", "entry").then((data) => {
console.log('formHost getFormsInfo, data:' + JSON.stringify(data));
console.log('formHost getFormsInfo, data:' + JSON.stringify(data));
}).catch((error) => {
console.log('formHost getFormsInfo, error:' + JSON.stringify(error));
console.log('formHost getFormsInfo, error:' + JSON.stringify(error));
});
```
## deleteInvalidForms
deleteInvalidForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;number&gt;): void;
deleteInvalidForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;number&gt;): void
根据列表删除应用程序的无效卡片。
根据列表删除应用程序的无效卡片。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -751,27 +742,27 @@ deleteInvalidForms(formIds: Array&lt;string&gt;, callback: AsyncCallback&lt;numb
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 有效卡片标识列表 |
| callback | AsyncCallback&lt;number&gt; | 是 | callback形式返回删除的卡片个数 |
| formIds | Array&lt;string&gt; | 是 | 有效卡片标识列表 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调函数。当根据列表删除应用程序的无效卡片成功,err为undefined,data为删除的卡片个数;否则为错误对象。 |
**示例:**
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.deleteInvalidForms(formIds, (error, data) => {
if (error.code) {
console.log('formHost deleteInvalidForms, error:' + JSON.stringify(error));
} else {
console.log('formHost deleteInvalidForms, data:' + JSON.stringify(data));
}
});
```
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.deleteInvalidForms(formIds, (error, data) => {
if (error.code) {
console.log('formHost deleteInvalidForms, error:' + JSON.stringify(error));
} else {
console.log('formHost deleteInvalidForms, data:' + JSON.stringify(data));
}
});
```
## deleteInvalidForms
deleteInvalidForms(formIds: Array&lt;string&gt;): Promise&lt;number&gt;;
deleteInvalidForms(formIds: Array&lt;string&gt;): Promise&lt;number&gt;
根据列表删除应用程序的无效卡片。
根据列表删除应用程序的无效卡片。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -781,30 +772,30 @@ deleteInvalidForms(formIds: Array&lt;string&gt;): Promise&lt;number&gt;;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 有效卡片标识列表 |
| formIds | Array&lt;string&gt; | 是 | 有效卡片标识列表 |
**返回值:**
| 类型 | 说明 |
| :------------ | :---------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回删除的卡片个数 |
| Promise&lt;number&gt; | Promise对象,返回删除的卡片个数。 |
**示例:**
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.deleteInvalidForms(formIds).then((data) => {
console.log('formHost deleteInvalidForms, data:' + JSON.stringify(data));
}).catch((error) => {
console.log('formHost deleteInvalidForms, error:' + JSON.stringify(error));
});
```
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.deleteInvalidForms(formIds).then((data) => {
console.log('formHost deleteInvalidForms, data:' + JSON.stringify(data));
}).catch((error) => {
console.log('formHost deleteInvalidForms, error:' + JSON.stringify(error));
});
```
## acquireFormState
acquireFormState(want: Want, callback: AsyncCallback&lt;formInfo.FormStateInfo&gt;): void;
acquireFormState(want: Want, callback: AsyncCallback&lt;formInfo.FormStateInfo&gt;): void
获取卡片状态
获取卡片状态。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM 和 ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
......@@ -814,36 +805,36 @@ acquireFormState(want: Want, callback: AsyncCallback&lt;formInfo.FormStateInfo&g
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| want | [Want](js-apis-application-Want.md) | 是 | 查询卡片状态时携带的want信息 |
| callback | AsyncCallback&lt;[FormStateInfo](js-apis-formInfo.md#formstateinfo)&gt; | 是 | callback形式返回卡片状态 |
| want | [Want](js-apis-application-Want.md) | 是 | 查询卡片状态时携带的want信息 |
| callback | AsyncCallback&lt;[FormStateInfo](js-apis-formInfo.md#formstateinfo)&gt; | 是 | 回调函数。当获取卡片状态成功,err为undefined,data为获取到的卡片状态;否则为错误对象。 |
**示例:**
```js
var want = {
"deviceId": "",
"bundleName": "ohos.samples.FormApplication",
"abilityName": "FormAbility",
"parameters": {
"ohos.extra.param.key.module_name": "entry",
"ohos.extra.param.key.form_name": "widget",
"ohos.extra.param.key.form_dimension": 2
}
};
formHost.acquireFormState(want, (error, data) => {
if (error.code) {
console.log('formHost acquireFormState, error:' + JSON.stringify(error));
} else {
console.log('formHost acquireFormState, data:' + JSON.stringify(data));
}
});
```
```js
var want = {
"deviceId": "",
"bundleName": "ohos.samples.FormApplication",
"abilityName": "FormAbility",
"parameters": {
"ohos.extra.param.key.module_name": "entry",
"ohos.extra.param.key.form_name": "widget",
"ohos.extra.param.key.form_dimension": 2
}
};
formHost.acquireFormState(want, (error, data) => {
if (error.code) {
console.log('formHost acquireFormState, error:' + JSON.stringify(error));
} else {
console.log('formHost acquireFormState, data:' + JSON.stringify(data));
}
});
```
## acquireFormState
acquireFormState(want: Want): Promise&lt;formInfo.FormStateInfo&gt;;
acquireFormState(want: Want): Promise&lt;formInfo.FormStateInfo&gt;
获取卡片状态。
获取卡片状态。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM 和 ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
......@@ -853,39 +844,39 @@ acquireFormState(want: Want): Promise&lt;formInfo.FormStateInfo&gt;;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| want | [Want](js-apis-application-Want.md) | 是 | 查询卡片状态时携带的want信息 |
| want | [Want](js-apis-application-Want.md) | 是 | 查询卡片状态时携带的want信息 |
**返回值:**
| 类型 | 说明 |
| :------------ | :---------------------------------- |
| Promise&lt;[FormStateInfo](js-apis-formInfo.md#formstateinfo)&gt; | Promise实例,用于返回卡片状态 |
| Promise&lt;[FormStateInfo](js-apis-formInfo.md#formstateinfo)&gt; | Promise对象,返回卡片状态。 |
**示例:**
```js
var want = {
"deviceId": "",
"bundleName": "ohos.samples.FormApplication",
"abilityName": "FormAbility",
"parameters": {
"ohos.extra.param.key.module_name": "entry",
"ohos.extra.param.key.form_name": "widget",
"ohos.extra.param.key.form_dimension": 2
}
};
formHost.acquireFormState(want).then((data) => {
console.log('formHost acquireFormState, data:' + JSON.stringify(data));
}).catch((error) => {
console.log('formHost acquireFormState, error:' + JSON.stringify(error));
});
```
```js
var want = {
"deviceId": "",
"bundleName": "ohos.samples.FormApplication",
"abilityName": "FormAbility",
"parameters": {
"ohos.extra.param.key.module_name": "entry",
"ohos.extra.param.key.form_name": "widget",
"ohos.extra.param.key.form_dimension": 2
}
};
formHost.acquireFormState(want).then((data) => {
console.log('formHost acquireFormState, data:' + JSON.stringify(data));
}).catch((error) => {
console.log('formHost acquireFormState, error:' + JSON.stringify(error));
});
```
## on("formUninstall")
on(type: "formUninstall", callback: Callback&lt;string&gt;): void;
on(type: "formUninstall", callback: Callback&lt;string&gt;): void
订阅卡片卸载事件。
订阅卡片卸载事件。使用callback异步回调。
**系统能力**:SystemCapability.Ability.Form
......@@ -893,23 +884,23 @@ on(type: "formUninstall", callback: Callback&lt;string&gt;): void;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| type | string | 是 | 填写"formUninstall",表示卡片卸载事件 |
| callback | Callback&lt;string&gt; | 是 | 需要注册的事件回调方法 |
| type | string | 是 | 填写"formUninstall",表示卡片卸载事件 |
| callback | Callback&lt;string&gt; | 是 | 回调函数。返回卡片标识。 |
**示例:**
```js
let callback = function(formId) {
console.log('formHost on formUninstall, formId:' + formId);
}
formHost.on("formUninstall", callback);
```
```js
let callback = function(formId) {
console.log('formHost on formUninstall, formId:' + formId);
}
formHost.on("formUninstall", callback);
```
## off("formUninstall")
off(type: "formUninstall", callback?: Callback&lt;string&gt;): void;
off(type: "formUninstall", callback?: Callback&lt;string&gt;): void
取消订阅卡片卸载事件。
取消订阅卡片卸载事件。使用callback异步回调。
**系统能力**:SystemCapability.Ability.Form
......@@ -917,23 +908,23 @@ off(type: "formUninstall", callback?: Callback&lt;string&gt;): void;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| type | string | 是 | 填写"formUninstall",表示卡片卸载事件 |
| callback | Callback&lt;string&gt; | 否 | 需要注销的事件回调方法。缺省时,表示注销所有已注册事件回调 |
| type | string | 是 | 填写"formUninstall",表示卡片卸载事件 |
| callback | Callback&lt;string&gt; | 否 | 回调函数。返回卡片标识。缺省时,表示注销所有已注册事件回调。 |
**示例:**
```js
let callback = function(formId) {
console.log('formHost on formUninstall, formId:' + formId);
}
formHost.off("formUninstall", callback);
```
```js
let callback = function(formId) {
console.log('formHost on formUninstall, formId:' + formId);
}
formHost.off("formUninstall", callback);
```
## notifyFormsVisible
notifyFormsVisible(formIds: Array&lt;string&gt;, isVisible: boolean, callback: AsyncCallback&lt;void&gt;): void;
notifyFormsVisible(formIds: Array&lt;string&gt;, isVisible: boolean, callback: AsyncCallback&lt;void&gt;): void
通知卡片是否可见。
通知卡片是否可见。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -943,26 +934,26 @@ notifyFormsVisible(formIds: Array&lt;string&gt;, isVisible: boolean, callback: A
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| isVisible | boolean | 是 | 是否可见 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| isVisible | boolean | 是 | 是否可见 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当通知卡片是否可见成功,err为undefined,否则为错误对象。 |
**示例:**
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.notifyFormsVisible(formIds, true, (error, data) => {
if (error.code) {
console.log('formHost notifyFormsVisible, error:' + JSON.stringify(error));
}
});
```
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.notifyFormsVisible(formIds, true, (error, data) => {
if (error.code) {
console.log('formHost notifyFormsVisible, error:' + JSON.stringify(error));
}
});
```
## notifyFormsVisible
notifyFormsVisible(formIds: Array&lt;string&gt;, isVisible: boolean): Promise&lt;void&gt;;
notifyFormsVisible(formIds: Array&lt;string&gt;, isVisible: boolean): Promise&lt;void&gt;
通知卡片是否可见。
通知卡片是否可见。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -970,33 +961,33 @@ notifyFormsVisible(formIds: Array&lt;string&gt;, isVisible: boolean): Promise&lt
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| isVisible | boolean | 是 | 是否可见 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表。 |
| isVisible | boolean | 是 | 是否可见。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**示例:**
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.notifyFormsVisible(formIds, true).then(() => {
console.log('formHost notifyFormsVisible success');
}).catch((error) => {
console.log('formHost notifyFormsVisible, error:' + JSON.stringify(error));
});
```
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.notifyFormsVisible(formIds, true).then(() => {
console.log('formHost notifyFormsVisible success');
}).catch((error) => {
console.log('formHost notifyFormsVisible, error:' + JSON.stringify(error));
});
```
## notifyFormsEnableUpdate
notifyFormsEnableUpdate(formIds: Array&lt;string&gt;, isEnableUpdate: boolean, callback: AsyncCallback&lt;void&gt;): void;
notifyFormsEnableUpdate(formIds: Array&lt;string&gt;, isEnableUpdate: boolean, callback: AsyncCallback&lt;void&gt;): void
通知卡片是否启用更新状态。
通知卡片是否启用更新状态。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -1006,26 +997,26 @@ notifyFormsEnableUpdate(formIds: Array&lt;string&gt;, isEnableUpdate: boolean, c
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| isEnableUpdate | boolean | 是 | 是否使能更新 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| isEnableUpdate | boolean | 是 | 是否使能更新 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当通知卡片是否启用更新状态成功,err为undefined,否则为错误对象。 |
**示例:**
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.notifyFormsEnableUpdate(formIds, true, (error, data) => {
if (error.code) {
console.log('formHost notifyFormsEnableUpdate, error:' + JSON.stringify(error));
}
});
```
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.notifyFormsEnableUpdate(formIds, true, (error, data) => {
if (error.code) {
console.log('formHost notifyFormsEnableUpdate, error:' + JSON.stringify(error));
}
});
```
## notifyFormsEnableUpdate
notifyFormsEnableUpdate(formIds: Array&lt;string&gt;, isEnableUpdate: boolean): Promise&lt;void&gt;;
notifyFormsEnableUpdate(formIds: Array&lt;string&gt;, isEnableUpdate: boolean): Promise&lt;void&gt;
通知卡片是否启用更新状态。
通知卡片是否启用更新状态。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -1035,32 +1026,30 @@ notifyFormsEnableUpdate(formIds: Array&lt;string&gt;, isEnableUpdate: boolean):
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| isEnableUpdate | boolean | 是 | 是否使能更新 |
| formIds | Array&lt;string&gt; | 是 | 卡片标识列表 |
| isEnableUpdate | boolean | 是 | 是否使能更新 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**示例:**
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.notifyFormsEnableUpdate(formIds, true).then(() => {
console.log('formHost notifyFormsEnableUpdate success');
}).catch((error) => {
console.log('formHost notifyFormsEnableUpdate, error:' + JSON.stringify(error));
});
```
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.notifyFormsEnableUpdate(formIds, true).then(() => {
console.log('formHost notifyFormsEnableUpdate success');
}).catch((error) => {
console.log('formHost notifyFormsEnableUpdate, error:' + JSON.stringify(error));
});
```
## shareForm<sup>9+</sup>
shareForm(formId: string, deviceId: string, callback: AsyncCallback&lt;void&gt;): void;
shareForm(formId: string, deviceId: string, callback: AsyncCallback&lt;void&gt;): void
指定formId和远程设备Id进行卡片分享。
此接口为系统接口。
指定formId和远程设备Id进行卡片分享。使用callback异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -1070,29 +1059,27 @@ shareForm(formId: string, deviceId: string, callback: AsyncCallback&lt;void&gt;)
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识 |
| deviceId | string | 是 | 远程设备标识 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回结果 |
| formId | string | 是 | 卡片标识 |
| deviceId | string | 是 | 远程设备标识 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数。当指定formId和远程设备Id进行卡片分享成功,err为undefined,否则为错误对象。 |
**示例:**
```js
var formId = "12400633174999288";
var deviceId = "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2";
formHost.shareForm(formId, deviceId, (error, data) => {
if (error.code) {
console.log('formHost shareForm, error:' + JSON.stringify(error));
}
});
```
```js
var formId = "12400633174999288";
var deviceId = "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2";
formHost.shareForm(formId, deviceId, (error, data) => {
if (error.code) {
console.log('formHost shareForm, error:' + JSON.stringify(error));
}
});
```
## shareForm<sup>9+</sup>
shareForm(formId: string, deviceId: string): Promise&lt;void&gt;;
shareForm(formId: string, deviceId: string): Promise&lt;void&gt;
指定formId和远程设备Id进行卡片分享。
此接口为系统接口。
指定formId和远程设备Id进行卡片分享。使用Promise异步回调。
**需要权限**:ohos.permission.REQUIRE_FORM
......@@ -1100,25 +1087,49 @@ shareForm(formId: string, deviceId: string): Promise&lt;void&gt;;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识 |
| deviceId | string | 是 | 远程设备标识 |
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识。 |
| deviceId | string | 是 | 远程设备标识。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 返回一个Promise,包含接口的结果 |
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;void&gt; | 无返回结果的Promise对象。 |
**参数:**
```js
var formId = "12400633174999288";
var deviceId = "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2";
formHost.shareForm(formId, deviceId).then(() => {
console.log('formHost shareForm success');
}).catch((error) => {
console.log('formHost shareForm, error:' + JSON.stringify(error));
});
```
\ No newline at end of file
```js
var formId = "12400633174999288";
var deviceId = "EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2";
formHost.shareForm(formId, deviceId).then(() => {
console.log('formHost shareForm success');
}).catch((error) => {
console.log('formHost shareForm, error:' + JSON.stringify(error));
});
```
## notifyFormsPrivacyProtected<sup>9+</sup>
notifyFormsPrivacyProtected(formIds: Array<string>, isProtected: boolean, callback: AsyncCallback<void>): void
**需要权限**:ohos.permission.REQUIRE_FORM
**系统能力**:SystemCapability.Ability.Form
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| formId | string | 是 | 卡片标识。 |
| deviceId | string | 是 | 远程设备标识。 |
```js
var formIds = new Array("12400633174999288", "12400633174999289");
formHost.notifyFormsPrivacyProtected(formIds, true).then(() => {
console.log('formHost shareForm success');
}).catch((error) => {
console.log('formHost shareForm, error:' + JSON.stringify(error));
});
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册