提交 e87781e4 编写于 作者: F fangJinliang1

fix docs

Signed-off-by: NfangJinliang1 <fangjinliang1@huawei.com>
Change-Id: If322b603844049d2802e0c95cffda7011813dd77
上级 c9f2beec
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
3. 创建WantAgentInfo信息。 3. 创建WantAgentInfo信息。
场景一:创建拉起UIAbility的WantAgent的WantAgentInfo信息。 场景一:创建拉起UIAbility的WantAgent的[WantAgentInfo](../reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md)信息。
```typescript ```typescript
let wantAgentObj = null; // 用于保存创建成功的wantAgent对象,后续使用其完成触发的动作。 let wantAgentObj = null; // 用于保存创建成功的wantAgent对象,后续使用其完成触发的动作。
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
}; };
``` ```
场景二:创建发布[公共事件](../application-models/common-event-overview.md)的WantAgent的WantAgentInfo信息。 场景二:创建发布[公共事件](../application-models/common-event-overview.md)的WantAgent的[WantAgentInfo](../reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md)信息。
```typescript ```typescript
let wantAgentObj = null; // 用于保存创建成功的WantAgent对象,后续使用其完成触发的动作。 let wantAgentObj = null; // 用于保存创建成功的WantAgent对象,后续使用其完成触发的动作。
......
...@@ -50,7 +50,7 @@ function publishCallback(err) { ...@@ -50,7 +50,7 @@ function publishCallback(err) {
} }
} }
//通知Request对象 //通知Request对象
var notificationRequest = { let notificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -60,8 +60,8 @@ var notificationRequest = { ...@@ -60,8 +60,8 @@ var notificationRequest = {
additionalText: "test_additionalText" additionalText: "test_additionalText"
} }
} }
} };
Notification.publish(notificationRequest, publishCallback) Notification.publish(notificationRequest, publishCallback);
``` ```
...@@ -95,7 +95,7 @@ publish(request: NotificationRequest): Promise\<void\> ...@@ -95,7 +95,7 @@ publish(request: NotificationRequest): Promise\<void\>
```js ```js
// 通知Request对象 // 通知Request对象
var notificationRequest = { let notificationRequest = {
notificationId: 1, notificationId: 1,
content: { content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -105,7 +105,7 @@ var notificationRequest = { ...@@ -105,7 +105,7 @@ var notificationRequest = {
additionalText: "test_additionalText" additionalText: "test_additionalText"
} }
} }
} };
Notification.publish(notificationRequest).then(() => { Notification.publish(notificationRequest).then(() => {
console.info("publish success"); console.info("publish success");
}); });
...@@ -156,9 +156,9 @@ function publishCallback(err) { ...@@ -156,9 +156,9 @@ function publishCallback(err) {
} }
} }
// 用户ID // 用户ID
var userId = 1 let userId = 1;
// 通知Request对象 // 通知Request对象
var notificationRequest = { let notificationRequest = {
id: 1, id: 1,
content: { content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -168,7 +168,7 @@ var notificationRequest = { ...@@ -168,7 +168,7 @@ var notificationRequest = {
additionalText: "test_additionalText" additionalText: "test_additionalText"
} }
} }
} };
Notification.publish(notificationRequest, userId, publishCallback); Notification.publish(notificationRequest, userId, publishCallback);
``` ```
...@@ -206,7 +206,7 @@ publish(request: NotificationRequest, userId: number): Promise\<void\> ...@@ -206,7 +206,7 @@ publish(request: NotificationRequest, userId: number): Promise\<void\>
**示例:** **示例:**
```js ```js
var notificationRequest = { let notificationRequest = {
notificationId: 1, notificationId: 1,
content: { content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -216,9 +216,9 @@ var notificationRequest = { ...@@ -216,9 +216,9 @@ var notificationRequest = {
additionalText: "test_additionalText" additionalText: "test_additionalText"
} }
} }
} };
var userId = 1 let userId = 1;
Notification.publish(notificationRequest, userId).then(() => { Notification.publish(notificationRequest, userId).then(() => {
console.info("publish success"); console.info("publish success");
...@@ -262,7 +262,7 @@ function cancelCallback(err) { ...@@ -262,7 +262,7 @@ function cancelCallback(err) {
console.info("cancel success"); console.info("cancel success");
} }
} }
Notification.cancel(0, "label", cancelCallback) Notification.cancel(0, "label", cancelCallback);
``` ```
...@@ -336,7 +336,7 @@ function cancelCallback(err) { ...@@ -336,7 +336,7 @@ function cancelCallback(err) {
console.info("cancel success"); console.info("cancel success");
} }
} }
Notification.cancel(0, cancelCallback) Notification.cancel(0, cancelCallback);
``` ```
...@@ -374,7 +374,7 @@ function cancelAllCallback(err) { ...@@ -374,7 +374,7 @@ function cancelAllCallback(err) {
console.info("cancelAll success"); console.info("cancelAll success");
} }
} }
Notification.cancelAll(cancelAllCallback) Notification.cancelAll(cancelAllCallback);
``` ```
...@@ -444,10 +444,10 @@ function addSlotCallBack(err) { ...@@ -444,10 +444,10 @@ function addSlotCallBack(err) {
} }
} }
// 通知slot对象 // 通知slot对象
var notificationSlot = { let notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} };
Notification.addSlot(notificationSlot, addSlotCallBack) Notification.addSlot(notificationSlot, addSlotCallBack);
``` ```
...@@ -482,9 +482,9 @@ addSlot(slot: NotificationSlot): Promise\<void\> ...@@ -482,9 +482,9 @@ addSlot(slot: NotificationSlot): Promise\<void\>
```js ```js
// 通知slot对象 // 通知slot对象
var notificationSlot = { let notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} };
Notification.addSlot(notificationSlot).then(() => { Notification.addSlot(notificationSlot).then(() => {
console.info("addSlot success"); console.info("addSlot success");
}); });
...@@ -526,7 +526,7 @@ function addSlotCallBack(err) { ...@@ -526,7 +526,7 @@ function addSlotCallBack(err) {
console.info("addSlot success"); console.info("addSlot success");
} }
} }
Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack) Notification.addSlot(Notification.SlotType.SOCIAL_COMMUNICATION, addSlotCallBack);
``` ```
...@@ -602,14 +602,14 @@ function addSlotsCallBack(err) { ...@@ -602,14 +602,14 @@ function addSlotsCallBack(err) {
} }
} }
// 通知slot对象 // 通知slot对象
var notificationSlot = { let notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} };
// 通知slot array 对象 // 通知slot array 对象
var notificationSlotArray = new Array(); let notificationSlotArray = new Array();
notificationSlotArray[0] = notificationSlot; notificationSlotArray[0] = notificationSlot;
Notification.addSlots(notificationSlotArray, addSlotsCallBack) Notification.addSlots(notificationSlotArray, addSlotsCallBack);
``` ```
...@@ -644,11 +644,11 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\> ...@@ -644,11 +644,11 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\>
```js ```js
// 通知slot对象 // 通知slot对象
var notificationSlot = { let notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} };
// 通知slot array 对象 // 通知slot array 对象
var notificationSlotArray = new Array(); let notificationSlotArray = new Array();
notificationSlotArray[0] = notificationSlot; notificationSlotArray[0] = notificationSlot;
Notification.addSlots(notificationSlotArray).then(() => { Notification.addSlots(notificationSlotArray).then(() => {
...@@ -692,8 +692,8 @@ function getSlotCallback(err,data) { ...@@ -692,8 +692,8 @@ function getSlotCallback(err,data) {
console.info("getSlot success"); console.info("getSlot success");
} }
} }
var slotType = Notification.SlotType.SOCIAL_COMMUNICATION; let slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification.getSlot(slotType, getSlotCallback) Notification.getSlot(slotType, getSlotCallback);
``` ```
...@@ -729,7 +729,7 @@ getSlot(slotType: SlotType): Promise\<NotificationSlot\> ...@@ -729,7 +729,7 @@ getSlot(slotType: SlotType): Promise\<NotificationSlot\>
**示例:** **示例:**
```js ```js
var slotType = Notification.SlotType.SOCIAL_COMMUNICATION; let slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification.getSlot(slotType).then((data) => { Notification.getSlot(slotType).then((data) => {
console.info("getSlot success, data: " + JSON.stringify(data)); console.info("getSlot success, data: " + JSON.stringify(data));
}); });
...@@ -770,7 +770,7 @@ function getSlotsCallback(err,data) { ...@@ -770,7 +770,7 @@ function getSlotsCallback(err,data) {
console.info("getSlots success"); console.info("getSlots success");
} }
} }
Notification.getSlots(getSlotsCallback) Notification.getSlots(getSlotsCallback);
``` ```
...@@ -841,8 +841,8 @@ function removeSlotCallback(err) { ...@@ -841,8 +841,8 @@ function removeSlotCallback(err) {
console.info("removeSlot success"); console.info("removeSlot success");
} }
} }
var slotType = Notification.SlotType.SOCIAL_COMMUNICATION; let slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification.removeSlot(slotType,removeSlotCallback) Notification.removeSlot(slotType,removeSlotCallback);
``` ```
...@@ -872,7 +872,7 @@ removeSlot(slotType: SlotType): Promise\<void\> ...@@ -872,7 +872,7 @@ removeSlot(slotType: SlotType): Promise\<void\>
**示例:** **示例:**
```js ```js
var slotType = Notification.SlotType.SOCIAL_COMMUNICATION; let slotType = Notification.SlotType.SOCIAL_COMMUNICATION;
Notification.removeSlot(slotType).then(() => { Notification.removeSlot(slotType).then(() => {
console.info("removeSlot success"); console.info("removeSlot success");
}); });
...@@ -912,7 +912,7 @@ function removeAllCallBack(err) { ...@@ -912,7 +912,7 @@ function removeAllCallBack(err) {
console.info("removeAllSlots success"); console.info("removeAllSlots success");
} }
} }
Notification.removeAllSlots(removeAllCallBack) Notification.removeAllSlots(removeAllCallBack);
``` ```
...@@ -982,9 +982,9 @@ function setNotificationEnablenCallback(err) { ...@@ -982,9 +982,9 @@ function setNotificationEnablenCallback(err) {
console.info("setNotificationEnablenCallback success"); console.info("setNotificationEnablenCallback success");
} }
} }
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.setNotificationEnable(bundle, false, setNotificationEnablenCallback); Notification.setNotificationEnable(bundle, false, setNotificationEnablenCallback);
``` ```
...@@ -1021,9 +1021,9 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\<void\> ...@@ -1021,9 +1021,9 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\<void\>
**示例:** **示例:**
```js ```js
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.setNotificationEnable(bundle, false).then(() => { Notification.setNotificationEnable(bundle, false).then(() => {
console.info("setNotificationEnable success"); console.info("setNotificationEnable success");
}); });
...@@ -1069,9 +1069,9 @@ function isNotificationEnabledCallback(err, data) { ...@@ -1069,9 +1069,9 @@ function isNotificationEnabledCallback(err, data) {
console.info("isNotificationEnabled success"); console.info("isNotificationEnabled success");
} }
} }
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback); Notification.isNotificationEnabled(bundle, isNotificationEnabledCallback);
``` ```
...@@ -1113,9 +1113,9 @@ isNotificationEnabled(bundle: BundleOption): Promise\<boolean\> ...@@ -1113,9 +1113,9 @@ isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
**示例:** **示例:**
```js ```js
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.isNotificationEnabled(bundle).then((data) => { Notification.isNotificationEnabled(bundle).then((data) => {
console.info("isNotificationEnabled success, data: " + JSON.stringify(data)); console.info("isNotificationEnabled success, data: " + JSON.stringify(data));
}); });
...@@ -1247,9 +1247,9 @@ function displayBadgeCallback(err) { ...@@ -1247,9 +1247,9 @@ function displayBadgeCallback(err) {
console.info("displayBadge success"); console.info("displayBadge success");
} }
} }
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.displayBadge(bundle, false, displayBadgeCallback); Notification.displayBadge(bundle, false, displayBadgeCallback);
``` ```
...@@ -1286,9 +1286,9 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\> ...@@ -1286,9 +1286,9 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
**示例:** **示例:**
```js ```js
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.displayBadge(bundle, false).then(() => { Notification.displayBadge(bundle, false).then(() => {
console.info("displayBadge success"); console.info("displayBadge success");
}); });
...@@ -1334,9 +1334,9 @@ function isBadgeDisplayedCallback(err, data) { ...@@ -1334,9 +1334,9 @@ function isBadgeDisplayedCallback(err, data) {
console.info("isBadgeDisplayed success"); console.info("isBadgeDisplayed success");
} }
} }
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback); Notification.isBadgeDisplayed(bundle, isBadgeDisplayedCallback);
``` ```
...@@ -1378,9 +1378,9 @@ isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\> ...@@ -1378,9 +1378,9 @@ isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
**示例:** **示例:**
```js ```js
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.isBadgeDisplayed(bundle).then((data) => { Notification.isBadgeDisplayed(bundle).then((data) => {
console.info("isBadgeDisplayed success, data: " + JSON.stringify(data)); console.info("isBadgeDisplayed success, data: " + JSON.stringify(data));
}); });
...@@ -1429,12 +1429,12 @@ function setSlotByBundleCallback(err) { ...@@ -1429,12 +1429,12 @@ function setSlotByBundleCallback(err) {
console.info("setSlotByBundle success"); console.info("setSlotByBundle success");
} }
} }
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
var notificationSlot = { let notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} };
Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback); Notification.setSlotByBundle(bundle, notificationSlot, setSlotByBundleCallback);
``` ```
...@@ -1471,12 +1471,12 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\> ...@@ -1471,12 +1471,12 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
**示例:** **示例:**
```js ```js
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
var notificationSlot = { let notificationSlot = {
type: Notification.SlotType.SOCIAL_COMMUNICATION type: Notification.SlotType.SOCIAL_COMMUNICATION
} };
Notification.setSlotByBundle(bundle, notificationSlot).then(() => { Notification.setSlotByBundle(bundle, notificationSlot).then(() => {
console.info("setSlotByBundle success"); console.info("setSlotByBundle success");
}); });
...@@ -1522,9 +1522,9 @@ function getSlotsByBundleCallback(err, data) { ...@@ -1522,9 +1522,9 @@ function getSlotsByBundleCallback(err, data) {
console.info("getSlotsByBundle success"); console.info("getSlotsByBundle success");
} }
} }
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback); Notification.getSlotsByBundle(bundle, getSlotsByBundleCallback);
``` ```
...@@ -1566,9 +1566,9 @@ getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>> ...@@ -1566,9 +1566,9 @@ getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>>
**示例:** **示例:**
```js ```js
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.getSlotsByBundle(bundle).then((data) => { Notification.getSlotsByBundle(bundle).then((data) => {
console.info("getSlotsByBundle success, data: " + JSON.stringify(data)); console.info("getSlotsByBundle success, data: " + JSON.stringify(data));
}); });
...@@ -1614,9 +1614,9 @@ function getSlotNumByBundleCallback(err, data) { ...@@ -1614,9 +1614,9 @@ function getSlotNumByBundleCallback(err, data) {
console.info("getSlotNumByBundle success"); console.info("getSlotNumByBundle success");
} }
} }
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback); Notification.getSlotNumByBundle(bundle, getSlotNumByBundleCallback);
``` ```
...@@ -1658,9 +1658,9 @@ getSlotNumByBundle(bundle: BundleOption): Promise\<number\> ...@@ -1658,9 +1658,9 @@ getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
**示例:** **示例:**
```js ```js
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.getSlotNumByBundle(bundle).then((data) => { Notification.getSlotNumByBundle(bundle).then((data) => {
console.info("getSlotNumByBundle success, data: " + JSON.stringify(data)); console.info("getSlotNumByBundle success, data: " + JSON.stringify(data));
}); });
...@@ -1921,7 +1921,7 @@ function cancelGroupCallback(err) { ...@@ -1921,7 +1921,7 @@ function cancelGroupCallback(err) {
} }
} }
var groupName = "GroupName"; let groupName = "GroupName";
Notification.cancelGroup(groupName, cancelGroupCallback); Notification.cancelGroup(groupName, cancelGroupCallback);
``` ```
...@@ -1953,7 +1953,7 @@ cancelGroup(groupName: string): Promise\<void\> ...@@ -1953,7 +1953,7 @@ cancelGroup(groupName: string): Promise\<void\>
**示例:** **示例:**
```js ```js
var groupName = "GroupName"; let groupName = "GroupName";
Notification.cancelGroup(groupName).then(() => { Notification.cancelGroup(groupName).then(() => {
console.info("cancelGroup success"); console.info("cancelGroup success");
}); });
...@@ -2001,8 +2001,8 @@ function removeGroupByBundleCallback(err) { ...@@ -2001,8 +2001,8 @@ function removeGroupByBundleCallback(err) {
} }
} }
var bundleOption = {bundle: "Bundle"}; let bundleOption = {bundle: "Bundle"};
var groupName = "GroupName"; let groupName = "GroupName";
Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCallback); Notification.removeGroupByBundle(bundleOption, groupName, removeGroupByBundleCallback);
``` ```
...@@ -2040,8 +2040,8 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\> ...@@ -2040,8 +2040,8 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
**示例:** **示例:**
```js ```js
var bundleOption = {bundle: "Bundle"}; let bundleOption = {bundle: "Bundle"};
var groupName = "GroupName"; let groupName = "GroupName";
Notification.removeGroupByBundle(bundleOption, groupName).then(() => { Notification.removeGroupByBundle(bundleOption, groupName).then(() => {
console.info("removeGroupByBundle success"); console.info("removeGroupByBundle success");
}); });
...@@ -2087,11 +2087,11 @@ function setDoNotDisturbDateCallback(err) { ...@@ -2087,11 +2087,11 @@ function setDoNotDisturbDateCallback(err) {
} }
} }
var doNotDisturbDate = { let doNotDisturbDate = {
type: Notification.DoNotDisturbType.TYPE_ONCE, type: Notification.DoNotDisturbType.TYPE_ONCE,
begin: new Date(), begin: new Date(),
end: new Date(2021, 11, 15, 18, 0) end: new Date(2021, 11, 15, 18, 0)
} };
Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback); Notification.setDoNotDisturbDate(doNotDisturbDate, setDoNotDisturbDateCallback);
``` ```
...@@ -2127,11 +2127,11 @@ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\> ...@@ -2127,11 +2127,11 @@ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\>
**示例:** **示例:**
```js ```js
var doNotDisturbDate = { let doNotDisturbDate = {
type: Notification.DoNotDisturbType.TYPE_ONCE, type: Notification.DoNotDisturbType.TYPE_ONCE,
begin: new Date(), begin: new Date(),
end: new Date(2021, 11, 15, 18, 0) end: new Date(2021, 11, 15, 18, 0)
} };
Notification.setDoNotDisturbDate(doNotDisturbDate).then(() => { Notification.setDoNotDisturbDate(doNotDisturbDate).then(() => {
console.info("setDoNotDisturbDate success"); console.info("setDoNotDisturbDate success");
}); });
...@@ -2178,13 +2178,13 @@ function setDoNotDisturbDateCallback(err) { ...@@ -2178,13 +2178,13 @@ function setDoNotDisturbDateCallback(err) {
} }
} }
var doNotDisturbDate = { let doNotDisturbDate = {
type: Notification.DoNotDisturbType.TYPE_ONCE, type: Notification.DoNotDisturbType.TYPE_ONCE,
begin: new Date(), begin: new Date(),
end: new Date(2021, 11, 15, 18, 0) end: new Date(2021, 11, 15, 18, 0)
} };
var userId = 1 let userId = 1;
Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCallback); Notification.setDoNotDisturbDate(doNotDisturbDate, userId, setDoNotDisturbDateCallback);
``` ```
...@@ -2222,13 +2222,13 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\> ...@@ -2222,13 +2222,13 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\>
**示例:** **示例:**
```js ```js
var doNotDisturbDate = { let doNotDisturbDate = {
type: Notification.DoNotDisturbType.TYPE_ONCE, type: Notification.DoNotDisturbType.TYPE_ONCE,
begin: new Date(), begin: new Date(),
end: new Date(2021, 11, 15, 18, 0) end: new Date(2021, 11, 15, 18, 0)
} };
var userId = 1 let userId = 1;
Notification.setDoNotDisturbDate(doNotDisturbDate, userId).then(() => { Notification.setDoNotDisturbDate(doNotDisturbDate, userId).then(() => {
console.info("setDoNotDisturbDate success"); console.info("setDoNotDisturbDate success");
...@@ -2352,7 +2352,7 @@ function getDoNotDisturbDateCallback(err,data) { ...@@ -2352,7 +2352,7 @@ function getDoNotDisturbDateCallback(err,data) {
} }
} }
var userId = 1 let userId = 1;
Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback); Notification.getDoNotDisturbDate(userId, getDoNotDisturbDateCallback);
``` ```
...@@ -2395,7 +2395,7 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\> ...@@ -2395,7 +2395,7 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
**示例:** **示例:**
```js ```js
var userId = 1 let userId = 1;
Notification.getDoNotDisturbDate(userId).then((data) => { Notification.getDoNotDisturbDate(userId).then((data) => {
console.info("getDoNotDisturbDate success, data: " + JSON.stringify(data)); console.info("getDoNotDisturbDate success, data: " + JSON.stringify(data));
...@@ -2508,7 +2508,7 @@ isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean\>): voi ...@@ -2508,7 +2508,7 @@ isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean\>): voi
**示例:** **示例:**
```javascript ```javascript
var templateName = 'process'; let templateName = 'process';
function isSupportTemplateCallback(err, data) { function isSupportTemplateCallback(err, data) {
if (err) { if (err) {
console.info("isSupportTemplate failed " + JSON.stringify(err)); console.info("isSupportTemplate failed " + JSON.stringify(err));
...@@ -2554,7 +2554,7 @@ isSupportTemplate(templateName: string): Promise\<boolean\> ...@@ -2554,7 +2554,7 @@ isSupportTemplate(templateName: string): Promise\<boolean\>
**示例:** **示例:**
```javascript ```javascript
var templateName = 'process'; let templateName = 'process';
Notification.isSupportTemplate(templateName).then((data) => { Notification.isSupportTemplate(templateName).then((data) => {
console.info("isSupportTemplate success, data: " + JSON.stringify(data)); console.info("isSupportTemplate success, data: " + JSON.stringify(data));
...@@ -2666,7 +2666,7 @@ function setDistributedEnableCallback() { ...@@ -2666,7 +2666,7 @@ function setDistributedEnableCallback() {
} }
}; };
var enable = true let enable = true;
Notification.setDistributedEnable(enable, setDistributedEnableCallback); Notification.setDistributedEnable(enable, setDistributedEnableCallback);
``` ```
...@@ -2703,7 +2703,7 @@ setDistributedEnable(enable: boolean): Promise\<void> ...@@ -2703,7 +2703,7 @@ setDistributedEnable(enable: boolean): Promise\<void>
**示例:** **示例:**
```javascript ```javascript
var enable = true let enable = true;
Notification.setDistributedEnable(enable).then(() => { Notification.setDistributedEnable(enable).then(() => {
console.info("setDistributedEnable success"); console.info("setDistributedEnable success");
...@@ -2824,11 +2824,11 @@ function setDistributedEnableByBundleCallback(err) { ...@@ -2824,11 +2824,11 @@ function setDistributedEnableByBundleCallback(err) {
} }
}; };
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
var enable = true let enable = true
Notification.setDistributedEnableByBundle(bundle, enable, setDistributedEnableByBundleCallback); Notification.setDistributedEnableByBundle(bundle, enable, setDistributedEnableByBundleCallback);
``` ```
...@@ -2867,11 +2867,11 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\<vo ...@@ -2867,11 +2867,11 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\<vo
**示例:** **示例:**
```javascript ```javascript
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
var enable = true let enable = true
Notification.setDistributedEnableByBundle(bundle, enable).then(() => { Notification.setDistributedEnableByBundle(bundle, enable).then(() => {
console.info("setDistributedEnableByBundle success"); console.info("setDistributedEnableByBundle success");
...@@ -2918,9 +2918,9 @@ function isDistributedEnabledByBundleCallback(data) { ...@@ -2918,9 +2918,9 @@ function isDistributedEnabledByBundleCallback(data) {
} }
}; };
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCallback); Notification.isDistributedEnabledByBundle(bundle, isDistributedEnabledByBundleCallback);
``` ```
...@@ -2964,9 +2964,9 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean> ...@@ -2964,9 +2964,9 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
**示例:** **示例:**
```javascript ```javascript
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
Notification.isDistributedEnabledByBundle(bundle).then((data) => { Notification.isDistributedEnabledByBundle(bundle).then((data) => {
console.info("isDistributedEnabledByBundle success, data: " + JSON.stringify(data)); console.info("isDistributedEnabledByBundle success, data: " + JSON.stringify(data));
...@@ -3096,9 +3096,9 @@ function callback(err) { ...@@ -3096,9 +3096,9 @@ function callback(err) {
} }
} }
// 被代理应用的包名 // 被代理应用的包名
let representativeBundle = "com.example.demo" let representativeBundle = "com.example.demo";
// 用户ID // 用户ID
let userId = 100 let userId = 100;
// NotificationRequest对象 // NotificationRequest对象
let request = { let request = {
id: 1, id: 1,
...@@ -3110,7 +3110,7 @@ let request = { ...@@ -3110,7 +3110,7 @@ let request = {
additionalText: "test_additionalText" additionalText: "test_additionalText"
} }
} }
} };
Notification.publishAsBundle(request, representativeBundle, userId, callback); Notification.publishAsBundle(request, representativeBundle, userId, callback);
``` ```
...@@ -3152,11 +3152,11 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user ...@@ -3152,11 +3152,11 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
```js ```js
// 被代理应用的包名 // 被代理应用的包名
let representativeBundle = "com.example.demo" let representativeBundle = "com.example.demo";
// 用户ID // 用户ID
let userId = 100 let userId = 100;
// NotificationRequest对象 // NotificationRequest对象
var request = { let request = {
id: 1, id: 1,
content: { content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
...@@ -3166,7 +3166,7 @@ var request = { ...@@ -3166,7 +3166,7 @@ var request = {
additionalText: "test_additionalText" additionalText: "test_additionalText"
} }
} }
} };
Notification.publishAsBundle(request, representativeBundle, userId).then(() => { Notification.publishAsBundle(request, representativeBundle, userId).then(() => {
console.info("publishAsBundle success"); console.info("publishAsBundle success");
...@@ -3218,9 +3218,9 @@ function cancelAsBundleCallback(err) { ...@@ -3218,9 +3218,9 @@ function cancelAsBundleCallback(err) {
} }
} }
// 被代理应用的包名 // 被代理应用的包名
let representativeBundle = "com.example.demo" let representativeBundle = "com.example.demo";
// 用户ID // 用户ID
let userId = 100 let userId = 100;
Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallback); Notification.cancelAsBundle(0, representativeBundle, userId, cancelAsBundleCallback);
``` ```
...@@ -3261,9 +3261,9 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis ...@@ -3261,9 +3261,9 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis
```js ```js
// 被代理应用的包名 // 被代理应用的包名
let representativeBundle = "com.example.demo" let representativeBundle = "com.example.demo";
// 用户ID // 用户ID
let userId = 100 let userId = 100;
Notification.cancelAsBundle(0, representativeBundle, userId).then(() => { Notification.cancelAsBundle(0, representativeBundle, userId).then(() => {
console.info("cancelAsBundle success"); console.info("cancelAsBundle success");
......
...@@ -56,12 +56,12 @@ function subscribeCallback(err) { ...@@ -56,12 +56,12 @@ function subscribeCallback(err) {
function onConsumeCallback(data) { function onConsumeCallback(data) {
console.info("Consume callback: " + JSON.stringify(data)); console.info("Consume callback: " + JSON.stringify(data));
} }
var subscriber = { let subscriber = {
onConsume: onConsumeCallback onConsume: onConsumeCallback
} };
var info = { let info = {
bundleNames: ["bundleName1","bundleName2"] bundleNames: ["bundleName1","bundleName2"]
} };
NotificationSubscribe.subscribe(subscriber, info, subscribeCallback); NotificationSubscribe.subscribe(subscriber, info, subscribeCallback);
``` ```
...@@ -107,9 +107,9 @@ function subscribeCallback(err) { ...@@ -107,9 +107,9 @@ function subscribeCallback(err) {
function onConsumeCallback(data) { function onConsumeCallback(data) {
console.info("Consume callback: " + JSON.stringify(data)); console.info("Consume callback: " + JSON.stringify(data));
} }
var subscriber = { let subscriber = {
onConsume: onConsumeCallback onConsume: onConsumeCallback
} };
NotificationSubscribe.subscribe(subscriber, subscribeCallback); NotificationSubscribe.subscribe(subscriber, subscribeCallback);
``` ```
...@@ -148,7 +148,7 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): ...@@ -148,7 +148,7 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo):
function onConsumeCallback(data) { function onConsumeCallback(data) {
console.info("Consume callback: " + JSON.stringify(data)); console.info("Consume callback: " + JSON.stringify(data));
} }
var subscriber = { let subscriber = {
onConsume: onConsumeCallback onConsume: onConsumeCallback
}; };
NotificationSubscribe.subscribe(subscriber).then(() => { NotificationSubscribe.subscribe(subscriber).then(() => {
...@@ -198,9 +198,9 @@ function unsubscribeCallback(err) { ...@@ -198,9 +198,9 @@ function unsubscribeCallback(err) {
function onDisconnectCallback(data) { function onDisconnectCallback(data) {
console.info("Cancel callback: " + JSON.stringify(data)); console.info("Cancel callback: " + JSON.stringify(data));
} }
var subscriber = { let subscriber = {
onDisconnect: onDisconnectCallback onDisconnect: onDisconnectCallback
} };
NotificationSubscribe.unsubscribe(subscriber, unsubscribeCallback); NotificationSubscribe.unsubscribe(subscriber, unsubscribeCallback);
``` ```
...@@ -238,7 +238,7 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\> ...@@ -238,7 +238,7 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
function onDisconnectCallback(data) { function onDisconnectCallback(data) {
console.info("Cancel callback: " + JSON.stringify(data)); console.info("Cancel callback: " + JSON.stringify(data));
} }
var subscriber = { let subscriber = {
onDisconnect: onDisconnectCallback onDisconnect: onDisconnectCallback
}; };
NotificationSubscribe.unsubscribe(subscriber).then(() => { NotificationSubscribe.unsubscribe(subscriber).then(() => {
...@@ -289,14 +289,14 @@ function removeCallback(err) { ...@@ -289,14 +289,14 @@ function removeCallback(err) {
console.info("remove success"); console.info("remove success");
} }
} }
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
var notificationKey = { let notificationKey = {
id: 0, id: 0,
label: "label", label: "label",
} };
var reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; let reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE;
NotificationSubscribe.remove(bundle, notificationKey, reason, removeCallback); NotificationSubscribe.remove(bundle, notificationKey, reason, removeCallback);
``` ```
...@@ -335,14 +335,14 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea ...@@ -335,14 +335,14 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
**示例:** **示例:**
```js ```js
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
var notificationKey = { let notificationKey = {
id: 0, id: 0,
label: "label", label: "label",
} };
var reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; let reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE;
NotificationSubscribe.remove(bundle, notificationKey, reason).then(() => { NotificationSubscribe.remove(bundle, notificationKey, reason).then(() => {
console.info("remove success"); console.info("remove success");
}); });
...@@ -382,7 +382,7 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>): ...@@ -382,7 +382,7 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>):
**示例:** **示例:**
```js ```js
var hashCode = 'hashCode' let hashCode = 'hashCode';
function removeCallback(err) { function removeCallback(err) {
if (err) { if (err) {
...@@ -391,7 +391,7 @@ function removeCallback(err) { ...@@ -391,7 +391,7 @@ function removeCallback(err) {
console.info("remove success"); console.info("remove success");
} }
} }
var reason = NotificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE; let reason = NotificationSubscribe.RemoveReason.CANCEL_REASON_REMOVE;
NotificationSubscribe.remove(hashCode, reason, removeCallback); NotificationSubscribe.remove(hashCode, reason, removeCallback);
``` ```
...@@ -428,8 +428,8 @@ remove(hashCode: string, reason: RemoveReason): Promise\<void\> ...@@ -428,8 +428,8 @@ remove(hashCode: string, reason: RemoveReason): Promise\<void\>
**示例:** **示例:**
```js ```js
var hashCode = 'hashCode' let hashCode = 'hashCode';
var reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE; let reason = NotificationSubscribe.RemoveReason.CLICK_REASON_REMOVE;
NotificationSubscribe.remove(hashCode, reason).then(() => { NotificationSubscribe.remove(hashCode, reason).then(() => {
console.info("remove success"); console.info("remove success");
}); });
...@@ -475,9 +475,9 @@ function removeAllCallback(err) { ...@@ -475,9 +475,9 @@ function removeAllCallback(err) {
console.info("removeAll success"); console.info("removeAll success");
} }
} }
var bundle = { let bundle = {
bundle: "bundleName1", bundle: "bundleName1",
} };
NotificationSubscribe.removeAll(bundle, removeAllCallback); NotificationSubscribe.removeAll(bundle, removeAllCallback);
``` ```
...@@ -600,7 +600,7 @@ function removeAllCallback(err) { ...@@ -600,7 +600,7 @@ function removeAllCallback(err) {
} }
} }
var userId = 1 let userId = 1;
NotificationSubscribe.removeAll(userId, removeAllCallback); NotificationSubscribe.removeAll(userId, removeAllCallback);
``` ```
...@@ -643,7 +643,7 @@ function removeAllCallback(err) { ...@@ -643,7 +643,7 @@ function removeAllCallback(err) {
} }
} }
var userId = 1 let userId = 1;
NotificationSubscribe.removeAll(userId, removeAllCallback); NotificationSubscribe.removeAll(userId, removeAllCallback);
``` ```
...@@ -689,7 +689,7 @@ function onConsumeCallback(data) { ...@@ -689,7 +689,7 @@ function onConsumeCallback(data) {
console.info('===> onConsume callback req.id:' + req.id); console.info('===> onConsume callback req.id:' + req.id);
}; };
var subscriber = { let subscriber = {
onConsume: onConsumeCallback onConsume: onConsumeCallback
}; };
...@@ -729,7 +729,7 @@ function onCancelCallback(data) { ...@@ -729,7 +729,7 @@ function onCancelCallback(data) {
console.info('===> onCancel callback req.id:' + req.id); console.info('===> onCancel callback req.id:' + req.id);
} }
var subscriber = { let subscriber = {
onCancel: onCancelCallback onCancel: onCancelCallback
}; };
...@@ -767,7 +767,7 @@ function onUpdateCallback(map) { ...@@ -767,7 +767,7 @@ function onUpdateCallback(map) {
console.info('===> onUpdateCallback map:' + JSON.stringify(map)); console.info('===> onUpdateCallback map:' + JSON.stringify(map));
} }
var subscriber = { let subscriber = {
onUpdate: onUpdateCallback onUpdate: onUpdateCallback
}; };
...@@ -799,7 +799,7 @@ function onConnectCallback() { ...@@ -799,7 +799,7 @@ function onConnectCallback() {
console.info('===> onConnect in test'); console.info('===> onConnect in test');
} }
var subscriber = { let subscriber = {
onConnect: onConnectCallback onConnect: onConnectCallback
}; };
...@@ -841,7 +841,7 @@ function onDisconnectCallback() { ...@@ -841,7 +841,7 @@ function onDisconnectCallback() {
console.info('===> onDisconnect in test'); console.info('===> onDisconnect in test');
} }
var subscriber = { let subscriber = {
onConnect: onConnectCallback, onConnect: onConnectCallback,
onDisconnect: onDisconnectCallback onDisconnect: onDisconnectCallback
}; };
...@@ -877,7 +877,7 @@ function onDestroyCallback() { ...@@ -877,7 +877,7 @@ function onDestroyCallback() {
console.info('===> onDestroy in test'); console.info('===> onDestroy in test');
} }
var subscriber = { let subscriber = {
onDestroy: onDestroyCallback onDestroy: onDestroyCallback
}; };
...@@ -915,7 +915,7 @@ function onDoNotDisturbDateChangeCallback(mode) { ...@@ -915,7 +915,7 @@ function onDoNotDisturbDateChangeCallback(mode) {
console.info('===> onDoNotDisturbDateChange:' + mode); console.info('===> onDoNotDisturbDateChange:' + mode);
} }
var subscriber = { let subscriber = {
onDoNotDisturbDateChange: onDoNotDisturbDateChangeCallback onDoNotDisturbDateChange: onDoNotDisturbDateChangeCallback
}; };
...@@ -956,7 +956,7 @@ function onEnabledNotificationChangedCallback(callbackData) { ...@@ -956,7 +956,7 @@ function onEnabledNotificationChangedCallback(callbackData) {
console.info("enable: ", callbackData.enable); console.info("enable: ", callbackData.enable);
}; };
var subscriber = { let subscriber = {
onEnabledNotificationChanged: onEnabledNotificationChangedCallback onEnabledNotificationChanged: onEnabledNotificationChangedCallback
}; };
......
...@@ -59,9 +59,9 @@ export default { ...@@ -59,9 +59,9 @@ export default {
clickAction: { clickAction: {
bundleName: 'com.example.testapp', bundleName: 'com.example.testapp',
abilityName: 'notificationDemo', abilityName: 'notificationDemo',
uri: '/path/to/notification', uri: '/path/to/notification'
}, }
}); });
}, }
} }
``` ```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册