Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
6a3f0817
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6a3f0817
编写于
8月 24, 2022
作者:
Z
zero-cyc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
通知删除接口
Signed-off-by:
N
zero-cyc
<
chenlien@huawei.com
>
Change-Id: If24453e9aa5efcb7894328e180f721731f1a0a9d
上级
bcf0265d
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
11 deletion
+28
-11
zh-cn/application-dev/reference/apis/js-apis-notification.md
zh-cn/application-dev/reference/apis/js-apis-notification.md
+28
-11
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-notification.md
浏览文件 @
6a3f0817
...
...
@@ -1422,7 +1422,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形式)。
...
...
@@ -1438,6 +1438,7 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCa
| --------------- | ---- | --- | ----------------------------------- | ---- | -------------------- |
| bundle | 是 | 否 |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| notificationKey | 是 | 否 |
[
NotificationKey
](
#notificationkey
)
| 是 | 通知键值。 |
| reason | 是 | 否 |
[
RemoveReason
](
#removereason9
)
| 是 | 通知删除原因。 |
| callback | 是 | 否 | AsyncCallback
\<
void
\>
| 是 | 删除指定通知回调函数。 |
**示例:**
...
...
@@ -1453,14 +1454,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形式)。
...
...
@@ -1476,6 +1478,7 @@ remove(bundle: BundleOption, notificationKey: NotificationKey): Promise\<void\>
| --------------- | ---- | --- | --------------- | ---- | ---------- |
| bundle | 是 | 否 |
[
BundleOption
](
#bundleoption
)
| 是 | 指定包信息。 |
| notificationKey | 是 | 否 |
[
NotificationKey
](
#notificationkey
)
| 是 | 通知键值。 |
| reason | 是 | 否 |
[
RemoveReason
](
#removereason9
)
| 是 | 通知删除原因。 |
**示例:**
...
...
@@ -1487,7 +1490,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=======================>
"
);
});
```
...
...
@@ -1496,7 +1500,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形式)。
...
...
@@ -1511,6 +1515,7 @@ remove(hashCode: string, callback: AsyncCallback\<void\>): void
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
| -------- | ---- | --- | --------------------- | ---- | -------------------- |
| hashCode | 是 | 否 | string | 是 | 通知唯一ID。 |
| reason | 是 | 否 |
[
RemoveReason
](
#removereason9
)
| 是 | 通知删除原因。 |
| callback | 是 | 否 | AsyncCallback
\<
void
\>
| 是 | 删除指定通知回调函数。 |
**示例:**
...
...
@@ -1521,15 +1526,15 @@ var hashCode = 'hashCode'
function
removeCallback
(
err
)
{
console
.
info
(
"
==========================>removeCallback=======================>
"
);
}
Notification
.
remove
(
hashCode
,
removeCallback
);
var
reason
=
Notification
.
RemoveReason
.
CANCEL_REASON_REMOVE
;
Notification
.
remove
(
hashCode
,
re
ason
,
re
moveCallback
);
```
## Notification.remove
remove(hashCode: string): Promise
\<
void
\>
remove(hashCode: string
, reason: RemoveReason
): Promise
\<
void
\>
删除指定通知(Promise形式)。
...
...
@@ -1544,13 +1549,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=======================>
"
);
});
```
...
...
@@ -3854,4 +3860,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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录