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

!8573 通知删除接口资料更新

Merge pull request !8573 from zero-cyc/0824_2
......@@ -1428,7 +1428,7 @@ Notification.getSlotNumByBundle(bundle).then((data) => {
## Notification.remove
remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback\<void\>): void
remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback\<void\>): void
删除指定通知(Callback形式)。
......@@ -1441,9 +1441,10 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCa
**参数:**
| 名称 | 类型 | 必填 | 描述 |
| --------------- | ----------------------------------- | ---- | -------------------- |
| --------------- | ----------------------------------| ---- | -------------------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 |
| notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 |
| reason | [RemoveReason](#removereason9) | 是 | 通知删除原因。 |
| callback | AsyncCallback\<void\> | 是 | 删除指定通知回调函数。 |
**示例:**
......@@ -1459,14 +1460,15 @@ var notificationKey = {
id: 0,
label: "label",
}
Notification.remove(bundle, notificationKey, removeCallback);
var reason = Notification.RemoveReason.CLICK_REASON_REMOVE;
Notification.remove(bundle, notificationKey, reason, removeCallback);
```
## Notification.remove
remove(bundle: BundleOption, notificationKey: NotificationKey): Promise\<void\>
remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise\<void\>
删除指定通知(Promise形式)。
......@@ -1482,6 +1484,7 @@ remove(bundle: BundleOption, notificationKey: NotificationKey): Promise\<void\>
| --------------- | --------------- | ---- | ---------- |
| bundle | [BundleOption](#bundleoption) | 是 | 指定包信息。 |
| notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 |
| reason | [RemoveReason](#removereason9) | 是 | 通知删除原因。 |
**示例:**
......@@ -1493,7 +1496,8 @@ var notificationKey = {
id: 0,
label: "label",
}
Notification.remove(bundle, notificationKey).then(() => {
var reason = Notification.RemoveReason.CLICK_REASON_REMOVE;
Notification.remove(bundle, notificationKey, reason).then(() => {
console.info("==========================>removeCallback=======================>");
});
```
......@@ -1502,7 +1506,7 @@ Notification.remove(bundle, notificationKey).then(() => {
## Notification.remove
remove(hashCode: string, callback: AsyncCallback\<void\>): void
remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>): void
删除指定通知(Callback形式)。
......@@ -1517,6 +1521,7 @@ remove(hashCode: string, callback: AsyncCallback\<void\>): void
| 名称 | 类型 | 必填 | 描述 |
| -------- | --------------------- | ---- | -------------------- |
| hashCode | string | 是 | 通知唯一ID。 |
| reason | [RemoveReason](#removereason9) | 是 | 通知删除原因。 |
| callback | AsyncCallback\<void\> | 是 | 删除指定通知回调函数。 |
**示例:**
......@@ -1527,15 +1532,15 @@ var hashCode = 'hashCode'
function removeCallback(err) {
console.info("==========================>removeCallback=======================>");
}
Notification.remove(hashCode, removeCallback);
var reason = Notification.RemoveReason.CANCEL_REASON_REMOVE;
Notification.remove(hashCode, reason, removeCallback);
```
## Notification.remove
remove(hashCode: string): Promise\<void\>
remove(hashCode: string, reason: RemoveReason): Promise\<void\>
删除指定通知(Promise形式)。
......@@ -1550,13 +1555,14 @@ remove(hashCode: string): Promise\<void\>
| 名称 | 类型 | 必填 | 描述 |
| -------- | ---------- | ---- | ---------- |
| hashCode | string | 是 | 通知唯一ID。 |
| reason | [RemoveReason](#removereason9) | 是 | 通知删除原因。 |
**示例:**
```js
var hashCode = 'hashCode'
Notification.remove(hashCode).then(() => {
var reason = Notification.RemoveReason.CLICK_REASON_REMOVE;
Notification.remove(hashCode, reason).then(() => {
console.info("==========================>removeCallback=======================>");
});
```
......@@ -3876,4 +3882,15 @@ Notification.subscribe(subscriber, subscribeCallback);
| -------------------- | --- | -------------------- |
| TYPE_NORMAL | 0 | 一般通知。 |
| TYPE_CONTINUOUS | 1 | 连续通知。 |
| TYPE_TIMER | 2 | 计划通知。 |
\ No newline at end of file
| TYPE_TIMER | 2 | 计划通知。 |
## RemoveReason<sup>9+</sup>
**系统能力**:SystemCapability.Notification.Notification
**系统API**: 此接口为系统接口,三方应用不支持调用。
| 名称 | 值 | 描述 |
| -------------------- | --- | -------------------- |
| CLICK_REASON_REMOVE | 1 | 点击通知后删除通知。 |
| CANCEL_REASON_REMOVE | 2 | 用户删除通知。 |
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册