提交 f2b93f2c 编写于 作者: C chenyuyan

新增卡片接口参数调整changelog

Signed-off-by: Nchenyuyan <chenyuyan3@huawei.com>
Change-Id: I5e4e7caef2c3555160a6001597d7da610ff1c420
上级 6cbd8feb
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
**关键的接口/组件变更** **关键的接口/组件变更**
涉及接口移动、权限修改前的接口原型:
| 接口 | 修改前所属d.ts | 修改后所属d.ts | 修改前所需权限 | 修改后所需权限 | | 接口 | 修改前所属d.ts | 修改后所属d.ts | 修改前所需权限 | 修改后所需权限 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| on('formAdd') | @ohos.app.form.formHost.d.ts | @ohos.app.form.formObserver.d.ts | ohos.permission.REQUIRE_FORM | ohos.permission.OBSERVE_FORM_RUNNING | @ohos.app.form.formHost.d.ts | @ohos.app.form.formObserver.d.ts | ohos.permission.REQUIRE_FORM|ohos.permission.OBSERVE_FORM_RUNNING| | on('formAdd') | @ohos.app.form.formHost.d.ts | @ohos.app.form.formObserver.d.ts | ohos.permission.REQUIRE_FORM | ohos.permission.OBSERVE_FORM_RUNNING | @ohos.app.form.formHost.d.ts | @ohos.app.form.formObserver.d.ts | ohos.permission.REQUIRE_FORM|ohos.permission.OBSERVE_FORM_RUNNING|
...@@ -49,3 +47,98 @@ try { ...@@ -49,3 +47,98 @@ try {
} }
``` ```
## cl.formfwk.2 事件订阅,取消订阅相关接口(on/off)参数顺序调整
事件订阅,取消订阅相关接口(on/off)中的callback调整为接口最后一个参数。
**变更影响**
对于已发布的js接口,可能影响三方应用的兼容性。
**关键的接口/组件变更**
修改前的接口原型:
```js
function on(type: 'formAdd', observerCallback: Callback<formInfo.RunningFormInfo>, bundleName?: string): void;
function off(type: 'formAdd', observerCallback?: Callback<formInfo.RunningFormInfo>, bundleName?: string): void;
function on(type: 'formRemove', observerCallback: Callback<formInfo.RunningFormInfo>, bundleName?: string): void;
function off(type: 'formRemove', observerCallback?: Callback<formInfo.RunningFormInfo>, bundleName?: string): void;
function on(
type: 'notifyVisible',
observerCallback: Callback<Array<formInfo.RunningFormInfo>>,
hostBundleName?: string
): void;
function off(
type: 'notifyVisible',
observerCallback?: Callback<Array<formInfo.RunningFormInfo>>,
hostBundleName?: string
): void;
function on(
type: 'notifyInvisible',
observerCallback: Callback<Array<formInfo.RunningFormInfo>>,
hostBundleName?: string
): void;
function off(
type: 'notifyInvisible',
observerCallback?: Callback<Array<formInfo.RunningFormInfo>>,
hostBundleName?: string
): void;
```
修改后的接口原型:
```js
function on(type: 'formAdd', observerCallback: Callback<formInfo.RunningFormInfo>): void;
function on(type: 'formAdd', hostBundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void;
function off(type: 'formAdd', hostBundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void;
function on(type: 'formRemove', observerCallback: Callback<formInfo.RunningFormInfo>): void;
function on(type: 'formRemove', hostBundleName: string, observerCallback: Callback<formInfo.RunningFormInfo>): void;
function off(type: 'formRemove', hostBundleName?: string, observerCallback?: Callback<formInfo.RunningFormInfo>): void;
function on(type: 'notifyVisible', observerCallback: Callback<Array<formInfo.RunningFormInfo>>): void;
function on(
type: 'notifyVisible',
hostBundleName: string,
observerCallback: Callback<Array<formInfo.RunningFormInfo>>
): void;
function off(
type: 'notifyVisible',
hostBundleName?: string,
observerCallback?: Callback<Array<formInfo.RunningFormInfo>>
): void;
function on(type: 'notifyInvisible', observerCallback: Callback<Array<formInfo.RunningFormInfo>>): void;
function on(
type: 'notifyInvisible',
hostBundleName: string,
observerCallback: Callback<Array<formInfo.RunningFormInfo>>,
): void;
function off(
type: 'notifyInvisible',
hostBundleName?: string,
observerCallback?: Callback<Array<formInfo.RunningFormInfo>>
): void;
```
**适配指导**
已使用相关接口开发的应用工程,需要对接口进行适配。从OpenHarmony 4.0.9.5版本起,相关接口使用应注意入参顺序的调整,将callback作为最后一个参数进行接口调用。
**示例:**
```js
import formObserver from @ohos.app.form.formObserver.d.ts;
let bundleName = 'ohos.samples.FormApplication';
let callback = function(data) {
console.log('a new form added, data: ${JSON.stringify(data)');
}
formHost.on('formAdd', callback);
formHost.on('formAdd', bundleName, callback);
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册