Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
7633bbe0
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7633bbe0
编写于
2月 04, 2023
作者:
zyjhandsome
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
js-apis-notifications模块异常场景只有err.code
Signed-off-by:
zyjhandsome
<
zyjhandsome@126.com
>
上级
2cdf4cad
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
2 addition
and
142 deletion
+2
-142
zh-cn/application-dev/reference/apis/js-apis-notification.md
zh-cn/application-dev/reference/apis/js-apis-notification.md
+2
-142
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-notification.md
浏览文件 @
7633bbe0
...
...
@@ -35,7 +35,7 @@ publish(request: NotificationRequest, callback: AsyncCallback\<void\>): void
// publish回调
function
publishCallback
(
err
)
{
if
(
err
.
code
)
{
console
.
error
(
`publish failed, code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
`publish failed, code is
${
err
.
code
}
`
);
}
else
{
console
.
info
(
"
publish success
"
);
}
...
...
@@ -55,8 +55,6 @@ let notificationRequest = {
Notification
.
publish
(
notificationRequest
,
publishCallback
);
```
## Notification.publish
publish(request: NotificationRequest): Promise
\<
void
\>
...
...
@@ -118,7 +116,7 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<v
// publish回调
function
publishCallback
(
err
)
{
if
(
err
.
code
)
{
console
.
error
(
`publish failed, code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
console
.
error
(
`publish failed, code is
${
err
.
code
}
`
);
}
else
{
console
.
info
(
"
publish success
"
);
}
...
...
@@ -298,8 +296,6 @@ function cancelAllCallback(err) {
Notification
.
cancelAll
(
cancelAllCallback
);
```
## Notification.cancelAll
cancelAll(): Promise
\<
void
\>
...
...
@@ -316,8 +312,6 @@ Notification.cancelAll().then(() => {
});
```
## Notification.addSlot
addSlot(slot: NotificationSlot, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -355,8 +349,6 @@ let notificationSlot = {
Notification
.
addSlot
(
notificationSlot
,
addSlotCallBack
);
```
## Notification.addSlot
addSlot(slot: NotificationSlot): Promise
\<
void
\>
...
...
@@ -387,8 +379,6 @@ Notification.addSlot(notificationSlot).then(() => {
});
```
## Notification.addSlot
addSlot(type: SlotType, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -418,8 +408,6 @@ function addSlotCallBack(err) {
Notification
.
addSlot
(
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
,
addSlotCallBack
);
```
## Notification.addSlot
addSlot(type: SlotType): Promise
\<
void
\>
...
...
@@ -442,8 +430,6 @@ Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION).then(() => {
});
```
## Notification.addSlots
addSlots(slots: Array
\<
NotificationSlot
\>
, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -485,8 +471,6 @@ notificationSlotArray[0] = notificationSlot;
Notification
.
addSlots
(
notificationSlotArray
,
addSlotsCallBack
);
```
## Notification.addSlots
addSlots(slots: Array
\<
NotificationSlot
\>
): Promise
\<
void
\>
...
...
@@ -521,8 +505,6 @@ Notification.addSlots(notificationSlotArray).then(() => {
});
```
## Notification.getSlot
getSlot(slotType: SlotType, callback: AsyncCallback
\<
NotificationSlot
\>
): void
...
...
@@ -553,8 +535,6 @@ let slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification
.
getSlot
(
slotType
,
getSlotCallback
);
```
## Notification.getSlot
getSlot(slotType: SlotType): Promise
\<
NotificationSlot
\>
...
...
@@ -584,8 +564,6 @@ Notification.getSlot(slotType).then((data) => {
});
```
## Notification.getSlots
getSlots(callback: AsyncCallback
<Array
\<
NotificationSlot
\
>
>): void
...
...
@@ -614,8 +592,6 @@ function getSlotsCallback(err, data) {
Notification
.
getSlots
(
getSlotsCallback
);
```
## Notification.getSlots
getSlots(): Promise
\<
Array
\<
NotificationSlot
\>
>
...
...
@@ -638,8 +614,6 @@ Notification.getSlots().then((data) => {
});
```
## Notification.removeSlot
removeSlot(slotType: SlotType, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -670,8 +644,6 @@ let slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification
.
removeSlot
(
slotType
,
removeSlotCallback
);
```
## Notification.removeSlot
removeSlot(slotType: SlotType): Promise
\<
void
\>
...
...
@@ -695,8 +667,6 @@ Notification.removeSlot(slotType).then(() => {
});
```
## Notification.removeAllSlots
removeAllSlots(callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -724,8 +694,6 @@ function removeAllCallBack(err) {
Notification
.
removeAllSlots
(
removeAllCallBack
);
```
## Notification.removeAllSlots
removeAllSlots(): Promise
\<
void
\>
...
...
@@ -742,8 +710,6 @@ Notification.removeAllSlots().then(() => {
});
```
## Notification.subscribe
subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -787,8 +753,6 @@ let info = {
Notification
.
subscribe
(
subscriber
,
info
,
subscribeCallback
);
```
## Notification.subscribe
subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -827,8 +791,6 @@ let subscriber = {
Notification
.
subscribe
(
subscriber
,
subscribeCallback
);
```
## Notification.subscribe
subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise
\<
void
\>
...
...
@@ -862,8 +824,6 @@ Notification.subscribe(subscriber).then(() => {
});
```
## Notification.unsubscribe
unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -902,8 +862,6 @@ let subscriber = {
Notification
.
unsubscribe
(
subscriber
,
unsubscribeCallback
);
```
## Notification.unsubscribe
unsubscribe(subscriber: NotificationSubscriber): Promise
\<
void
\>
...
...
@@ -936,8 +894,6 @@ Notification.unsubscribe(subscriber).then(() => {
});
```
## Notification.enableNotification
enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -974,8 +930,6 @@ let bundle = {
Notification
.
enableNotification
(
bundle
,
false
,
enableNotificationCallback
);
```
## Notification.enableNotification
enableNotification(bundle: BundleOption, enable: boolean): Promise
\<
void
\>
...
...
@@ -1006,8 +960,6 @@ Notification.enableNotification(bundle, false).then(() => {
});
```
## Notification.isNotificationEnabled
isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback
\<
boolean
\>
): void
...
...
@@ -1043,8 +995,6 @@ let bundle = {
Notification
.
isNotificationEnabled
(
bundle
,
isNotificationEnabledCallback
);
```
## Notification.isNotificationEnabled
isNotificationEnabled(bundle: BundleOption): Promise
\<
boolean
\>
...
...
@@ -1080,8 +1030,6 @@ Notification.isNotificationEnabled(bundle).then((data) => {
});
```
## Notification.isNotificationEnabled
isNotificationEnabled(callback: AsyncCallback
\<
boolean
\>
): void
...
...
@@ -1114,8 +1062,6 @@ function isNotificationEnabledCallback(err, data) {
Notification
.
isNotificationEnabled
(
isNotificationEnabledCallback
);
```
## Notification.isNotificationEnabled
isNotificationEnabled(): Promise
\<
boolean
\>
...
...
@@ -1148,8 +1094,6 @@ Notification.isNotificationEnabled().then((data) => {
});
```
## Notification.displayBadge
displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -1186,8 +1130,6 @@ let bundle = {
Notification
.
displayBadge
(
bundle
,
false
,
displayBadgeCallback
);
```
## Notification.displayBadge
displayBadge(bundle: BundleOption, enable: boolean): Promise
\<
void
\>
...
...
@@ -1218,8 +1160,6 @@ Notification.displayBadge(bundle, false).then(() => {
});
```
## Notification.isBadgeDisplayed
isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback
\<
boolean
\>
): void
...
...
@@ -1255,8 +1195,6 @@ let bundle = {
Notification
.
isBadgeDisplayed
(
bundle
,
isBadgeDisplayedCallback
);
```
## Notification.isBadgeDisplayed
isBadgeDisplayed(bundle: BundleOption): Promise
\<
boolean
\>
...
...
@@ -1292,8 +1230,6 @@ Notification.isBadgeDisplayed(bundle).then((data) => {
});
```
## Notification.setSlotByBundle
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -1333,8 +1269,6 @@ let notificationSlot = {
Notification
.
setSlotByBundle
(
bundle
,
notificationSlot
,
setSlotByBundleCallback
);
```
## Notification.setSlotByBundle
setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise
\<
void
\>
...
...
@@ -1368,8 +1302,6 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => {
});
```
## Notification.getSlotsByBundle
getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback
<Array
\<
NotificationSlot
\
>
>): void
...
...
@@ -1405,8 +1337,6 @@ let bundle = {
Notification
.
getSlotsByBundle
(
bundle
,
getSlotsByBundleCallback
);
```
## Notification.getSlotsByBundle
getSlotsByBundle(bundle: BundleOption): Promise
<Array
\<
NotificationSlot
\
>
>
...
...
@@ -1442,8 +1372,6 @@ Notification.getSlotsByBundle(bundle).then((data) => {
});
```
## Notification.getSlotNumByBundle
getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback
\<
number
\>
): void
...
...
@@ -1479,8 +1407,6 @@ let bundle = {
Notification
.
getSlotNumByBundle
(
bundle
,
getSlotNumByBundleCallback
);
```
## Notification.getSlotNumByBundle
getSlotNumByBundle(bundle: BundleOption): Promise
\<
number
\>
...
...
@@ -1516,8 +1442,6 @@ Notification.getSlotNumByBundle(bundle).then((data) => {
});
```
## Notification.remove
remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -1560,8 +1484,6 @@ let reason = Notification.RemoveReason.CLICK_REASON_REMOVE;
Notification
.
remove
(
bundle
,
notificationKey
,
reason
,
removeCallback
);
```
## Notification.remove
remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise
\<
void
\>
...
...
@@ -1598,8 +1520,6 @@ Notification.remove(bundle, notificationKey, reason).then(() => {
});
```
## Notification.remove
remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -1636,8 +1556,6 @@ let reason = Notification.RemoveReason.CANCEL_REASON_REMOVE;
Notification
.
remove
(
hashCode
,
reason
,
removeCallback
);
```
## Notification.remove
remove(hashCode: string, reason: RemoveReason): Promise
\<
void
\>
...
...
@@ -1667,8 +1585,6 @@ Notification.remove(hashCode, reason).then(() => {
});
```
## Notification.removeAll
removeAll(bundle: BundleOption, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -1704,8 +1620,6 @@ let bundle = {
Notification
.
removeAll
(
bundle
,
removeAllCallback
);
```
## Notification.removeAll
removeAll(callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -1738,8 +1652,6 @@ function removeAllCallback(err) {
Notification
.
removeAll
(
removeAllCallback
);
```
## Notification.removeAll
removeAll(bundle?: BundleOption): Promise
\<
void
\>
...
...
@@ -1861,8 +1773,6 @@ function getAllActiveNotificationsCallback(err, data) {
Notification
.
getAllActiveNotifications
(
getAllActiveNotificationsCallback
);
```
## Notification.getAllActiveNotifications
getAllActiveNotifications(): Promise
\<
Array
\<
[
NotificationRequest
](
#notificationrequest
)
\>\>
...
...
@@ -1889,8 +1799,6 @@ Notification.getAllActiveNotifications().then((data) => {
});
```
## Notification.getActiveNotificationCount
getActiveNotificationCount(callback: AsyncCallback
\<
number
\>
): void
...
...
@@ -1919,8 +1827,6 @@ function getActiveNotificationCountCallback(err, data) {
Notification
.
getActiveNotificationCount
(
getActiveNotificationCountCallback
);
```
## Notification.getActiveNotificationCount
getActiveNotificationCount(): Promise
\<
number
\>
...
...
@@ -1943,8 +1849,6 @@ Notification.getActiveNotificationCount().then((data) => {
});
```
## Notification.getActiveNotifications
getActiveNotifications(callback: AsyncCallback
<Array
\<
NotificationRequest
\
>
>): void
...
...
@@ -1973,8 +1877,6 @@ function getActiveNotificationsCallback(err, data) {
Notification
.
getActiveNotifications
(
getActiveNotificationsCallback
);
```
## Notification.getActiveNotifications
getActiveNotifications(): Promise
\<
Array
\<
[
NotificationRequest
](
#notificationrequest
)
\>\>
...
...
@@ -1997,8 +1899,6 @@ Notification.getActiveNotifications().then((data) => {
});
```
## Notification.cancelGroup<sup>8+</sup>
cancelGroup(groupName: string, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -2030,8 +1930,6 @@ let groupName = "GroupName";
Notification
.
cancelGroup
(
groupName
,
cancelGroupCallback
);
```
## Notification.cancelGroup<sup>8+</sup>
cancelGroup(groupName: string): Promise
\<
void
\>
...
...
@@ -2055,8 +1953,6 @@ Notification.cancelGroup(groupName).then(() => {
});
```
## Notification.removeGroupByBundle<sup>8+</sup>
removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -2094,8 +1990,6 @@ let groupName = "GroupName";
Notification
.
removeGroupByBundle
(
bundleOption
,
groupName
,
removeGroupByBundleCallback
);
```
## Notification.removeGroupByBundle<sup>8+</sup>
removeGroupByBundle(bundle: BundleOption, groupName: string): Promise
\<
void
\>
...
...
@@ -2125,8 +2019,6 @@ Notification.removeGroupByBundle(bundleOption, groupName).then(() => {
});
```
## Notification.setDoNotDisturbDate<sup>8+</sup>
setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -2166,8 +2058,6 @@ let doNotDisturbDate = {
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
,
setDoNotDisturbDateCallback
);
```
## Notification.setDoNotDisturbDate<sup>8+</sup>
setDoNotDisturbDate(date: DoNotDisturbDate): Promise
\<
void
\>
...
...
@@ -2241,8 +2131,6 @@ let userId = 1
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
,
userId
,
setDoNotDisturbDateCallback
);
```
## Notification.setDoNotDisturbDate<sup>8+</sup>
setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise
\<
void
\>
...
...
@@ -2311,8 +2199,6 @@ function getDoNotDisturbDateCallback(err, data) {
Notification
.
getDoNotDisturbDate
(
getDoNotDisturbDateCallback
);
```
## Notification.getDoNotDisturbDate<sup>8+</sup>
getDoNotDisturbDate(): Promise
\<
DoNotDisturbDate
\>
...
...
@@ -2375,8 +2261,6 @@ let userId = 1;
Notification
.
getDoNotDisturbDate
(
userId
,
getDoNotDisturbDateCallback
);
```
## Notification.getDoNotDisturbDate<sup>8+</sup>
getDoNotDisturbDate(userId: number): Promise
\<
DoNotDisturbDate
\>
...
...
@@ -2444,8 +2328,6 @@ function supportDoNotDisturbModeCallback(err,data) {
Notification
.
supportDoNotDisturbMode
(
supportDoNotDisturbModeCallback
);
```
## Notification.supportDoNotDisturbMode<sup>8+</sup>
supportDoNotDisturbMode(): Promise
\<
boolean
\>
...
...
@@ -2472,8 +2354,6 @@ Notification.supportDoNotDisturbMode().then((data) => {
});
```
## Notification.isSupportTemplate<sup>8+</sup>
isSupportTemplate(templateName: string, callback: AsyncCallback
\<
boolean
\>
): void
...
...
@@ -2504,8 +2384,6 @@ function isSupportTemplateCallback(err, data) {
Notification
.
isSupportTemplate
(
templateName
,
isSupportTemplateCallback
);
```
## Notification.isSupportTemplate<sup>8+</sup>
isSupportTemplate(templateName: string): Promise
\<
boolean
\>
...
...
@@ -2536,8 +2414,6 @@ Notification.isSupportTemplate(templateName).then((data) => {
});
```
## Notification.requestEnableNotification<sup>8+</sup>
requestEnableNotification(callback: AsyncCallback
\<
void
\>
): void
...
...
@@ -2566,8 +2442,6 @@ function requestEnableNotificationCallback(err) {
Notification
.
requestEnableNotification
(
requestEnableNotificationCallback
);
```
## Notification.requestEnableNotification<sup>8+</sup>
requestEnableNotification(): Promise
\<
void
\>
...
...
@@ -2620,8 +2494,6 @@ let enable = true;
Notification
.
enableDistributed
(
enable
,
enabledNotificationCallback
);
```
## Notification.enableDistributed<sup>8+</sup>
enableDistributed(enable: boolean): Promise
\<
void>
...
...
@@ -2678,8 +2550,6 @@ function isDistributedEnabledCallback(err, data) {
Notification
.
isDistributedEnabled
(
isDistributedEnabledCallback
);
```
## Notification.isDistributedEnabled<sup>8+</sup>
isDistributedEnabled(): Promise
\<
boolean>
...
...
@@ -2743,8 +2613,6 @@ let enable = true;
Notification
.
enableDistributedByBundle
(
bundle
,
enable
,
enableDistributedByBundleCallback
);
```
## Notification.enableDistributedByBundle<sup>8+</sup>
enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise
\<
void>
...
...
@@ -2814,8 +2682,6 @@ let bundle = {
Notification
.
isDistributedEnabledByBundle
(
bundle
,
isDistributedEnabledByBundleCallback
);
```
## Notification.isDistributedEnabledByBundle<sup>8+</sup>
isDistributedEnabledByBundle(bundle: BundleOption): Promise
\<
boolean>
...
...
@@ -2885,8 +2751,6 @@ function getDeviceRemindTypeCallback(err,data) {
Notification
.
getDeviceRemindType
(
getDeviceRemindTypeCallback
);
```
## Notification.getDeviceRemindType<sup>8+</sup>
getDeviceRemindType(): Promise
\<
DeviceRemindType
\>
...
...
@@ -3381,8 +3245,6 @@ Notification.getSyncNotificationEnabledWithoutApp(userId).then((data) => {
});
```
## NotificationSubscriber
作为订阅通知接口
[
subscribe
](
#notificationsubscribe
)
的入参,提供订阅者接收到新通知、取消通知等的回调方法。
...
...
@@ -3797,8 +3659,6 @@ Notification.enableNotification(bundle, false).then(() => {
| bundle | string | 是 | 是 | 应用的包信息。 |
| uid | number | 是 | 是 | 用户ID。 |
## NotificationKey
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Notification.Notification
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录