提交 287b9999 编写于 作者: W wusongqing

updated docs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 8d5fb164
# FormExtension
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **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.
Provides **FormExtension** APIs.
......@@ -42,6 +42,7 @@ Called to notify the widget provider that a **Form** instance (widget) has been
- Example
```
export default class MyFormExtension extends FormExtension {
onCreate(want) {
console.log('FormExtension onCreate, want:' + want.abilityName);
let dataObj1 = {
......@@ -51,6 +52,7 @@ Called to notify the widget provider that a **Form** instance (widget) has been
let obj1 = formBindingData.createFormBindingData(dataObj1);
return obj1;
}
}
```
## onCastToNormal
......@@ -68,9 +70,11 @@ Called to notify the widget provider that a temporary widget has been converted
- Example
```
export default class MyFormExtension extends FormExtension {
onCastToNormal(formId) {
console.log('FormExtension onCastToNormal, formId:' + formId);
}
}
```
## onUpdate
......@@ -88,6 +92,7 @@ Called to notify the widget provider that a widget has been updated. After obtai
- Example
```
export default class MyFormExtension extends FormExtension {
onUpdate(formId) {
console.log('FormExtension onUpdate, formId:' + formId);
let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
......@@ -97,6 +102,7 @@ Called to notify the widget provider that a widget has been updated. After obtai
}).catch((error) => {
console.error('Operation updateForm failed. Cause: ' + error);});
}
}
```
## onVisibilityChange
......@@ -114,6 +120,7 @@ Called to notify the widget provider of the change of visibility.
- Example
```
export default class MyFormExtension extends FormExtension {
onVisibilityChange(newStatus) {
console.log('FormExtension onVisibilityChange, newStatus:' + newStatus);
let obj2 = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
......@@ -127,6 +134,7 @@ Called to notify the widget provider of the change of visibility.
console.error('Operation updateForm failed. Cause: ' + error);});
}
}
}
```
## onEvent
......@@ -145,9 +153,11 @@ Called to instruct the widget provider to receive and process the widget event.
- Example
```
export default class MyFormExtension extends FormExtension {
onEvent(formId, message) {
console.log('FormExtension onEvent, formId:' + formId + ", message:" + message);
}
}
```
## onDestroy
......@@ -165,7 +175,9 @@ Called to notify the widget provider that a **Form** instance (widget) has been
- Example
```
export default class MyFormExtension extends FormExtension {
onDestroy(formId) {
console.log('FormExtension onDestroy, formId:' + formId);
}
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册