未验证 提交 1439c3b7 编写于 作者: O openharmony_ci 提交者: Gitee

!5369 Add isRequestPublishFormSupported Reference

Merge pull request !5369 from 闫文豪/feature51
......@@ -346,3 +346,83 @@ SystemCapability.Ability.Form
console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error));
});
```
## isRequestPublishFormSupported<sup>9+<sup>
isRequestPublishFormSupported(callback: AsyncCallback&lt;boolean&gt;): void;
查询是否支持发布一张卡片到使用方。
**系统能力:** SystemCapability.Ability.Form
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | callback形式返回是否支持发布一张卡片到使用方 |
**示例:**
```js
formProvider.isRequestPublishFormSupported((error, isSupported) => {
if (error.code) {
console.log('formProvider isRequestPublishFormSupported, error:' + JSON.stringify(error));
} else {
if (isSupported) {
var want = {
abilityName: "FormAbility",
parameters: {
"ohos.extra.param.key.form_dimension": 2,
"ohos.extra.param.key.form_name": "widget",
"ohos.extra.param.key.module_name": "entry"
}
};
formProvider.requestPublishForm(want, (error, data) => {
if (error.code) {
console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error));
} else {
console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data));
}
});
}
}
});
```
## isRequestPublishFormSupported<sup>9+</sup>
isRequestPublishFormSupported(): Promise&lt;boolean&gt;;
查询是否支持发布一张卡片到使用方。
**系统能力:** SystemCapability.Ability.Form
**返回值:**
| 类型 | 说明 |
| :------------ | :---------------------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回是否支持发布一张卡片到使用方 |
**示例:**
```js
formProvider.isRequestPublishFormSupported().then((isSupported) => {
if (isSupported) {
var want = {
abilityName: "FormAbility",
parameters: {
"ohos.extra.param.key.form_dimension": 2,
"ohos.extra.param.key.form_name": "widget",
"ohos.extra.param.key.module_name": "entry"
}
};
formProvider.requestPublishForm(want).then((data) => {
console.log('formProvider requestPublishForm success, form ID is :' + JSON.stringify(data));
}).catch((error) => {
console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error));
});
}
}).catch((error) => {
console.log('formProvider isRequestPublishFormSupported, error:' + JSON.stringify(error));
});
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册