提交 5611a87b 编写于 作者: R rcy-hw

update api and user guide

Signed-off-by: Nrcy-hw <renchunyang@huawei.com>
上级 18e35ec4
...@@ -269,15 +269,14 @@ Adds a reminder notification slot. This API uses an asynchronous callback to ret ...@@ -269,15 +269,14 @@ Adds a reminder notification slot. This API uses an asynchronous callback to ret
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Reminder notification slot to add.| | slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Notification slot to add, only support set its type attribute.|
| callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes| Asynchronous callback used to return the result.|
**Example** **Example**
```js ```js
let mySlot = { let mySlot = {
type: 3, type: notification.SlotType.SOCIAL_COMMUNICATION
sound: "/sdcard/music2.mp3"
} }
reminderAgent.addNotificationSlot(mySlot, (err, data) => { reminderAgent.addNotificationSlot(mySlot, (err, data) => {
console.log("addNotificationSlot callback"); console.log("addNotificationSlot callback");
...@@ -297,7 +296,7 @@ Adds a reminder notification slot. This API uses a promise to return the result. ...@@ -297,7 +296,7 @@ Adds a reminder notification slot. This API uses a promise to return the result.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| Reminder notification slot to add.| | slot | [NotificationSlot](js-apis-notification.md#notificationslot) | Yes| notification slot to add, only support set its type attribute.|
**Return value** **Return value**
...@@ -309,8 +308,7 @@ Adds a reminder notification slot. This API uses a promise to return the result. ...@@ -309,8 +308,7 @@ Adds a reminder notification slot. This API uses a promise to return the result.
```js ```js
let mySlot = { let mySlot = {
type: 3, type: notification.SlotType.SOCIAL_COMMUNICATION
sound: "/sdcard/music2.mp3"
} }
reminderAgent.addNotificationSlot(mySlot).then(() => { reminderAgent.addNotificationSlot(mySlot).then(() => {
console.log("addNotificationSlot promise"); console.log("addNotificationSlot promise");
......
...@@ -269,15 +269,17 @@ addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback&lt;void&gt;) ...@@ -269,15 +269,17 @@ addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback&lt;void&gt;)
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | 是 | notification&nbsp;slot实例。 | | slot | [NotificationSlot](js-apis-notification.md#notificationslot) | 是 | notification&nbsp;slot实例,仅支持设置其type属性。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 异步回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 异步回调。 |
**说明**
使用NotificationSlot需要导入: import notification from '@ohos.notification'
**示例** **示例**
```js ```js
let mySlot = { let mySlot = {
type: 3, type: notification.SlotType.SOCIAL_COMMUNICATION
sound: "/sdcard/music2.mp3"
} }
reminderAgent.addNotificationSlot(mySlot, (err, data) => { reminderAgent.addNotificationSlot(mySlot, (err, data) => {
console.log("addNotificationSlot callback"); console.log("addNotificationSlot callback");
...@@ -297,7 +299,10 @@ addNotificationSlot(slot: NotificationSlot): Promise&lt;void&gt; ...@@ -297,7 +299,10 @@ addNotificationSlot(slot: NotificationSlot): Promise&lt;void&gt;
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| slot | [NotificationSlot](js-apis-notification.md#notificationslot) | 是 | notification&nbsp;slot实例。 | | slot | [NotificationSlot](js-apis-notification.md#notificationslot) | 是 | notification&nbsp;slot实例,仅支持设置其type属性。 |
**说明**
使用NotificationSlot需要导入: import notification from '@ohos.notification'
**返回值** **返回值**
...@@ -309,8 +314,7 @@ addNotificationSlot(slot: NotificationSlot): Promise&lt;void&gt; ...@@ -309,8 +314,7 @@ addNotificationSlot(slot: NotificationSlot): Promise&lt;void&gt;
```js ```js
let mySlot = { let mySlot = {
type: 3, type: notification.SlotType.SOCIAL_COMMUNICATION
sound: "/sdcard/music2.mp3"
} }
reminderAgent.addNotificationSlot(mySlot).then(() => { reminderAgent.addNotificationSlot(mySlot).then(() => {
console.log("addNotificationSlot promise"); console.log("addNotificationSlot promise");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册