提交 851bc5b7 编写于 作者: X XKK

docs文档修复

Signed-off-by: NXKK <huyingsong@huawei.com>
上级 b31f71e1
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| --------------------- | --------------------------------------------- | --- |-----------------------------------------------------------------------| |-------------------------------| --------------------------------------------- | --- |-----------------------------------------------------------------------|
| content | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | 是 | 通知内容。 | | content | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | 是 | 通知内容。 |
| id | number | 否 | 通知ID。 | | id | number | 否 | 通知ID。 |
| slotType | [SlotType](js-apis-notificationManager.md#slottype) | 否 | 通道类型。 | | slotType | [SlotType](js-apis-notificationManager.md#slottype) | 否 | 通道类型。 |
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
| classification | string | 否 | 通知分类。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 | | classification | string | 否 | 通知分类。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
| groupName<sup>8+<sup> | string | 否 | 组通知名称。 | | groupName<sup>8+<sup> | string | 否 | 组通知名称。 |
| template<sup>8+<sup> | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | 否 | 通知模板。 | | template<sup>8+<sup> | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | 否 | 通知模板。 |
| isRemoveAllowed<sup>10+<sup> | boolean | 否 | 通知是否能被移除(点击通知下方删除按钮无法删除,左滑不出现删除按钮)。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 | | isRemoveAllowed<sup>8+<sup> | boolean | 否 | 通知是否能被移除(点击通知下方删除按钮无法删除,左滑不出现删除按钮)。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
| source<sup>8+<sup> | number | 否 | 通知源。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 | | source<sup>8+<sup> | number | 否 | 通知源。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
| distributedOption<sup>8+<sup> | [DistributedOptions](#distributedoptions) | 否 | 分布式通知的选项。 | | distributedOption<sup>8+<sup> | [DistributedOptions](#distributedoptions) | 否 | 分布式通知的选项。 |
| deviceId<sup>8+<sup> | string | 否 | 通知源的deviceId。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 | | deviceId<sup>8+<sup> | string | 否 | 通知源的deviceId。<br>**系统API**: 此接口为系统接口,三方应用不支持调用。 |
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
**系统接口**: 以下为系统接口,三方应用不支持调用。 **系统接口**: 以下为系统接口,三方应用不支持调用。
| 名称 | 类型 | 必填 | 说明 | | 名称 | 类型 | 必填 | 说明 |
| -------------------- | --------------------- | --- | ------------------------------------------ | |---------| --------------------- | --- |------------------------|
| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 通道类型。 | | slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 通道类型。 |
| level | number | 是 | 通知级别,不设置则根据通知渠道类型有默认值。 | | ranking | number | 是 | 通知级别,不设置则根据通知渠道类型有默认值。 |
| desc | string | 是 | 通知渠道描述信息。 | | hashCode | string | 是 | 通知唯一标识。 |
...@@ -2808,7 +2808,76 @@ notificationManager.requestEnableNotification().then(() => { ...@@ -2808,7 +2808,76 @@ notificationManager.requestEnableNotification().then(() => {
}); });
``` ```
## notificationManager.requestEnableNotification<sup>10+<sup>
requestEnableNotification(context: UIAbilityContext, callback: AsyncCallback\<void\>): void
应用请求通知使能模态弹窗(Callback形式)。
**系统能力**:SystemCapability.Notification.Notification
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- |--------------------|
| context | UIAbilityContext | 是 | 通知弹窗绑定Ability的上下文。 |
| callback | AsyncCallback\<void\> | 是 | 应用请求通知使能的回调函数。 |
**错误码:**
错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)
| 错误码ID | 错误信息 |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
**示例:**
```javascript
function requestEnableNotificationCallback(err) {
if (err) {
console.error(`requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("requestEnableNotification success");
}
};
notificationManager.requestEnableNotification(globalThis.uicontext, requestEnableNotificationCallback);
```
## notificationManager.requestEnableNotification<sup>10+<sup>
requestEnableNotification(context: UIAbilityContext): Promise\<void\>
应用请求通知使能模态弹窗(Promise形式)。
**系统能力**:SystemCapability.Notification.Notification
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- |--------------------|
| context | UIAbilityContext | 是 | 通知弹窗绑定Ability的上下文。 |
**错误码:**
错误码详细介绍请参考[errcode-notification](../errorcodes/errorcode-notification.md)
| 错误码ID | 错误信息 |
| -------- | ----------------------------------- |
| 1600001 | Internal error. |
| 1600002 | Marshalling or unmarshalling error. |
| 1600003 | Failed to connect service. |
**示例:**
```javascript
notificationManager.requestEnableNotification(globalThis.uicontext).then(() => {
console.info("requestEnableNotification success");
});
```
## notificationManager.setDistributedEnable ## notificationManager.setDistributedEnable
......
...@@ -443,9 +443,9 @@ notificationSubscribe.remove(hashCode, reason).then(() => { ...@@ -443,9 +443,9 @@ notificationSubscribe.remove(hashCode, reason).then(() => {
console.info("remove success"); console.info("remove success");
}); });
``` ```
## NotificationSubscribe.remove ## NotificationSubscribe.remove<sup>10+<sup>
remove(hashCodes: Array\<string\>, reason: RemoveReason, callback: AsyncCallback\<void\>): void remove(hashCodes: Array\<String\>, reason: RemoveReason, callback: AsyncCallback\<void\>): void
批量删除指定通知(Callback形式)。 批量删除指定通知(Callback形式)。
...@@ -459,7 +459,7 @@ remove(hashCodes: Array\<string\>, reason: RemoveReason, callback: AsyncCallback ...@@ -459,7 +459,7 @@ remove(hashCodes: Array\<string\>, reason: RemoveReason, callback: AsyncCallback
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
|-----------|-------------------------------| ---- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |-----------|-------------------------------| ---- |-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| hashCodes | Array\<string\> | 是 | 通知唯一ID数组集合。可以通过[onConsume](js-apis-inner-notification-notificationSubscriber.md#onConsume)回调的入参[SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)获取其内部[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象中的hashCode。 | | hashCodes | Array\<String\> | 是 | 通知唯一ID数组集合。可以通过[onConsume](js-apis-inner-notification-notificationSubscriber.md#onConsume)回调的入参[SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)获取其内部[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象中的hashCode。 |
| reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 |
| callback | AsyncCallback\<void\> | 是 | 删除指定通知回调函数。 | | callback | AsyncCallback\<void\> | 是 | 删除指定通知回调函数。 |
...@@ -489,9 +489,9 @@ let reason = notificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE; ...@@ -489,9 +489,9 @@ let reason = notificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE;
notificationSubscribe.remove(hashCodes, reason, removeCallback); notificationSubscribe.remove(hashCodes, reason, removeCallback);
``` ```
## NotificationSubscribe.remove ## NotificationSubscribe.remove<sup>10+<sup>
remove(hashCodes: Array\<string\>, reason: RemoveReason): Promise\<void\> remove(hashCodes: Array\<String\>, reason: RemoveReason): Promise\<void\>
批量删除指定通知(Promise形式)。 批量删除指定通知(Promise形式)。
...@@ -505,7 +505,7 @@ remove(hashCodes: Array\<string\>, reason: RemoveReason): Promise\<void\> ...@@ -505,7 +505,7 @@ remove(hashCodes: Array\<string\>, reason: RemoveReason): Promise\<void\>
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
|-----------|-------------------------------| ---- |-------------| |-----------|-------------------------------| ---- |-------------|
| hashCodes | Array\<string\> | 是 | 通知唯一ID数组集合。 | | hashCodes | Array\<String\> | 是 | 通知唯一ID数组集合。 |
| reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 |
**错误码:** **错误码:**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册