diff --git a/zh-cn/application-dev/reference/apis/js-apis-notification.md b/zh-cn/application-dev/reference/apis/js-apis-notification.md index d17c07abae38491a5008994019802b354f2b17fa..b9b5f24a3c572b586124b379039bca1eaa99cdb2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notification.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notification.md @@ -35,7 +35,7 @@ publish(request: NotificationRequest, callback: AsyncCallback\): 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\ @@ -118,7 +116,7 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\ @@ -316,8 +312,6 @@ Notification.cancelAll().then(() => { }); ``` - - ## Notification.addSlot addSlot(slot: NotificationSlot, callback: AsyncCallback\): void @@ -355,8 +349,6 @@ let notificationSlot = { Notification.addSlot(notificationSlot, addSlotCallBack); ``` - - ## Notification.addSlot addSlot(slot: NotificationSlot): Promise\ @@ -387,8 +379,6 @@ Notification.addSlot(notificationSlot).then(() => { }); ``` - - ## Notification.addSlot addSlot(type: SlotType, callback: AsyncCallback\): void @@ -418,8 +408,6 @@ function addSlotCallBack(err) { Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack); ``` - - ## Notification.addSlot addSlot(type: SlotType): Promise\ @@ -442,8 +430,6 @@ Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION).then(() => { }); ``` - - ## Notification.addSlots addSlots(slots: Array\, callback: AsyncCallback\): void @@ -485,8 +471,6 @@ notificationSlotArray[0] = notificationSlot; Notification.addSlots(notificationSlotArray, addSlotsCallBack); ``` - - ## Notification.addSlots addSlots(slots: Array\): Promise\ @@ -521,8 +505,6 @@ Notification.addSlots(notificationSlotArray).then(() => { }); ``` - - ## Notification.getSlot getSlot(slotType: SlotType, callback: AsyncCallback\): void @@ -553,8 +535,6 @@ let slotType = Notification.SlotType.SOCIAL_COMMUNICATION; Notification.getSlot(slotType, getSlotCallback); ``` - - ## Notification.getSlot getSlot(slotType: SlotType): Promise\ @@ -584,8 +564,6 @@ Notification.getSlot(slotType).then((data) => { }); ``` - - ## Notification.getSlots getSlots(callback: AsyncCallback>): void @@ -614,8 +592,6 @@ function getSlotsCallback(err, data) { Notification.getSlots(getSlotsCallback); ``` - - ## Notification.getSlots getSlots(): Promise\> @@ -638,8 +614,6 @@ Notification.getSlots().then((data) => { }); ``` - - ## Notification.removeSlot removeSlot(slotType: SlotType, callback: AsyncCallback\): void @@ -670,8 +644,6 @@ let slotType = Notification.SlotType.SOCIAL_COMMUNICATION; Notification.removeSlot(slotType,removeSlotCallback); ``` - - ## Notification.removeSlot removeSlot(slotType: SlotType): Promise\ @@ -695,8 +667,6 @@ Notification.removeSlot(slotType).then(() => { }); ``` - - ## Notification.removeAllSlots removeAllSlots(callback: AsyncCallback\): void @@ -724,8 +694,6 @@ function removeAllCallBack(err) { Notification.removeAllSlots(removeAllCallBack); ``` - - ## Notification.removeAllSlots removeAllSlots(): Promise\ @@ -742,8 +710,6 @@ Notification.removeAllSlots().then(() => { }); ``` - - ## Notification.subscribe subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback\): void @@ -787,8 +753,6 @@ let info = { Notification.subscribe(subscriber, info, subscribeCallback); ``` - - ## Notification.subscribe subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): void @@ -827,8 +791,6 @@ let subscriber = { Notification.subscribe(subscriber, subscribeCallback); ``` - - ## Notification.subscribe subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise\ @@ -862,8 +824,6 @@ Notification.subscribe(subscriber).then(() => { }); ``` - - ## Notification.unsubscribe unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): void @@ -902,8 +862,6 @@ let subscriber = { Notification.unsubscribe(subscriber, unsubscribeCallback); ``` - - ## Notification.unsubscribe unsubscribe(subscriber: NotificationSubscriber): Promise\ @@ -936,8 +894,6 @@ Notification.unsubscribe(subscriber).then(() => { }); ``` - - ## Notification.enableNotification enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback\): void @@ -974,8 +930,6 @@ let bundle = { Notification.enableNotification(bundle, false, enableNotificationCallback); ``` - - ## Notification.enableNotification enableNotification(bundle: BundleOption, enable: boolean): Promise\ @@ -1006,8 +960,6 @@ Notification.enableNotification(bundle, false).then(() => { }); ``` - - ## Notification.isNotificationEnabled isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\): void @@ -1043,8 +995,6 @@ let bundle = { Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback); ``` - - ## Notification.isNotificationEnabled isNotificationEnabled(bundle: BundleOption): Promise\ @@ -1080,8 +1030,6 @@ Notification.isNotificationEnabled(bundle).then((data) => { }); ``` - - ## Notification.isNotificationEnabled isNotificationEnabled(callback: AsyncCallback\): void @@ -1114,8 +1062,6 @@ function isNotificationEnabledCallback(err, data) { Notification.isNotificationEnabled(isNotificationEnabledCallback); ``` - - ## Notification.isNotificationEnabled isNotificationEnabled(): Promise\ @@ -1148,8 +1094,6 @@ Notification.isNotificationEnabled().then((data) => { }); ``` - - ## Notification.displayBadge displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\): void @@ -1186,8 +1130,6 @@ let bundle = { Notification.displayBadge(bundle, false, displayBadgeCallback); ``` - - ## Notification.displayBadge displayBadge(bundle: BundleOption, enable: boolean): Promise\ @@ -1218,8 +1160,6 @@ Notification.displayBadge(bundle, false).then(() => { }); ``` - - ## Notification.isBadgeDisplayed isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\): void @@ -1255,8 +1195,6 @@ let bundle = { Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback); ``` - - ## Notification.isBadgeDisplayed isBadgeDisplayed(bundle: BundleOption): Promise\ @@ -1292,8 +1230,6 @@ Notification.isBadgeDisplayed(bundle).then((data) => { }); ``` - - ## Notification.setSlotByBundle setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\): void @@ -1333,8 +1269,6 @@ let notificationSlot = { Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback); ``` - - ## Notification.setSlotByBundle setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\ @@ -1368,8 +1302,6 @@ Notification.setSlotByBundle(bundle, notificationSlot).then(() => { }); ``` - - ## Notification.getSlotsByBundle getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback>): void @@ -1405,8 +1337,6 @@ let bundle = { Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback); ``` - - ## Notification.getSlotsByBundle getSlotsByBundle(bundle: BundleOption): Promise> @@ -1442,8 +1372,6 @@ Notification.getSlotsByBundle(bundle).then((data) => { }); ``` - - ## Notification.getSlotNumByBundle getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\): void @@ -1479,8 +1407,6 @@ let bundle = { Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback); ``` - - ## Notification.getSlotNumByBundle getSlotNumByBundle(bundle: BundleOption): Promise\ @@ -1516,8 +1442,6 @@ Notification.getSlotNumByBundle(bundle).then((data) => { }); ``` - - ## Notification.remove remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback\): 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\ @@ -1598,8 +1520,6 @@ Notification.remove(bundle, notificationKey, reason).then(() => { }); ``` - - ## Notification.remove remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\): 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\ @@ -1667,8 +1585,6 @@ Notification.remove(hashCode, reason).then(() => { }); ``` - - ## Notification.removeAll removeAll(bundle: BundleOption, callback: AsyncCallback\): void @@ -1704,8 +1620,6 @@ let bundle = { Notification.removeAll(bundle, removeAllCallback); ``` - - ## Notification.removeAll removeAll(callback: AsyncCallback\): void @@ -1738,8 +1652,6 @@ function removeAllCallback(err) { Notification.removeAll(removeAllCallback); ``` - - ## Notification.removeAll removeAll(bundle?: BundleOption): Promise\ @@ -1861,8 +1773,6 @@ function getAllActiveNotificationsCallback(err, data) { Notification.getAllActiveNotifications(getAllActiveNotificationsCallback); ``` - - ## Notification.getAllActiveNotifications getAllActiveNotifications(): Promise\\> @@ -1889,8 +1799,6 @@ Notification.getAllActiveNotifications().then((data) => { }); ``` - - ## Notification.getActiveNotificationCount getActiveNotificationCount(callback: AsyncCallback\): void @@ -1919,8 +1827,6 @@ function getActiveNotificationCountCallback(err, data) { Notification.getActiveNotificationCount(getActiveNotificationCountCallback); ``` - - ## Notification.getActiveNotificationCount getActiveNotificationCount(): Promise\ @@ -1943,8 +1849,6 @@ Notification.getActiveNotificationCount().then((data) => { }); ``` - - ## Notification.getActiveNotifications getActiveNotifications(callback: AsyncCallback>): void @@ -1973,8 +1877,6 @@ function getActiveNotificationsCallback(err, data) { Notification.getActiveNotifications(getActiveNotificationsCallback); ``` - - ## Notification.getActiveNotifications getActiveNotifications(): Promise\\> @@ -1997,8 +1899,6 @@ Notification.getActiveNotifications().then((data) => { }); ``` - - ## Notification.cancelGroup8+ cancelGroup(groupName: string, callback: AsyncCallback\): void @@ -2030,8 +1930,6 @@ let groupName = "GroupName"; Notification.cancelGroup(groupName, cancelGroupCallback); ``` - - ## Notification.cancelGroup8+ cancelGroup(groupName: string): Promise\ @@ -2055,8 +1953,6 @@ Notification.cancelGroup(groupName).then(() => { }); ``` - - ## Notification.removeGroupByBundle8+ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback\): void @@ -2094,8 +1990,6 @@ let groupName = "GroupName"; Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCallback); ``` - - ## Notification.removeGroupByBundle8+ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\ @@ -2125,8 +2019,6 @@ Notification.removeGroupByBundle(bundleOption, groupName).then(() => { }); ``` - - ## Notification.setDoNotDisturbDate8+ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\): void @@ -2166,8 +2058,6 @@ let doNotDisturbDate = { Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback); ``` - - ## Notification.setDoNotDisturbDate8+ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\ @@ -2241,8 +2131,6 @@ let userId = 1 Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCallback); ``` - - ## Notification.setDoNotDisturbDate8+ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\ @@ -2311,8 +2199,6 @@ function getDoNotDisturbDateCallback(err, data) { Notification.getDoNotDisturbDate(getDoNotDisturbDateCallback); ``` - - ## Notification.getDoNotDisturbDate8+ getDoNotDisturbDate(): Promise\ @@ -2375,8 +2261,6 @@ let userId = 1; Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback); ``` - - ## Notification.getDoNotDisturbDate8+ getDoNotDisturbDate(userId: number): Promise\ @@ -2444,8 +2328,6 @@ function supportDoNotDisturbModeCallback(err,data) { Notification.supportDoNotDisturbMode(supportDoNotDisturbModeCallback); ``` - - ## Notification.supportDoNotDisturbMode8+ supportDoNotDisturbMode(): Promise\ @@ -2472,8 +2354,6 @@ Notification.supportDoNotDisturbMode().then((data) => { }); ``` - - ## Notification.isSupportTemplate8+ isSupportTemplate(templateName: string, callback: AsyncCallback\): void @@ -2504,8 +2384,6 @@ function isSupportTemplateCallback(err, data) { Notification.isSupportTemplate(templateName, isSupportTemplateCallback); ``` - - ## Notification.isSupportTemplate8+ isSupportTemplate(templateName: string): Promise\ @@ -2536,8 +2414,6 @@ Notification.isSupportTemplate(templateName).then((data) => { }); ``` - - ## Notification.requestEnableNotification8+ requestEnableNotification(callback: AsyncCallback\): void @@ -2566,8 +2442,6 @@ function requestEnableNotificationCallback(err) { Notification.requestEnableNotification(requestEnableNotificationCallback); ``` - - ## Notification.requestEnableNotification8+ requestEnableNotification(): Promise\ @@ -2620,8 +2494,6 @@ let enable = true; Notification.enableDistributed(enable, enabledNotificationCallback); ``` - - ## Notification.enableDistributed8+ enableDistributed(enable: boolean): Promise\ @@ -2678,8 +2550,6 @@ function isDistributedEnabledCallback(err, data) { Notification.isDistributedEnabled(isDistributedEnabledCallback); ``` - - ## Notification.isDistributedEnabled8+ isDistributedEnabled(): Promise\ @@ -2743,8 +2613,6 @@ let enable = true; Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundleCallback); ``` - - ## Notification.enableDistributedByBundle8+ enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise\ @@ -2814,8 +2682,6 @@ let bundle = { Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCallback); ``` - - ## Notification.isDistributedEnabledByBundle8+ isDistributedEnabledByBundle(bundle: BundleOption): Promise\ @@ -2885,8 +2751,6 @@ function getDeviceRemindTypeCallback(err,data) { Notification.getDeviceRemindType(getDeviceRemindTypeCallback); ``` - - ## Notification.getDeviceRemindType8+ getDeviceRemindType(): Promise\ @@ -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