未验证 提交 36c50a0c 编写于 作者: O openharmony_ci 提交者: Gitee

!14289 优化部分error异常日志打印

Merge pull request !14289 from zyjhandsome/master
......@@ -43,7 +43,7 @@
notificationManager.requestEnableNotification().then(() => {
console.info(`[ANS] requestEnableNotification success`);
}).catch((err) => {
console.error(`[ANS] requestEnableNotification failed, errCode[${err}]`);
console.error(`[ANS] requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -74,7 +74,7 @@
```ts
notificationSubscribe.subscribe(subscriber, (err, data) => { // callback形式调用异步接口
if (err) {
console.error(`[ANS] failed to subscribe, error[${err}]`);
console.error(`[ANS] subscribe failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`[ANS] subscribeTest success : + ${data}`);
......
......@@ -112,7 +112,7 @@
notificationManager.publish(notificationRequest, (err) => {
if (err) {
console.error(`[ANS] failed to publish, error[${err}]`);
console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`[ANS] publish success`);
......
......@@ -10,7 +10,7 @@
## 接口说明
[isSupportTemplate()](../reference/apis/js-apis-notificationManager.md#notificationissupporttemplate)是查询模板是否支持接口,目前仅支持进度条模板。
[isSupportTemplate()](../reference/apis/js-apis-notificationManager.md#notificationmanagerissupporttemplate)是查询模板是否支持接口,目前仅支持进度条模板。
| **接口名** | **描述** |
| -------- | -------- |
......@@ -35,7 +35,7 @@
let isSupportTpl: boolean = data; // isSupportTpl的值为true表示支持支持downloadTemplate模板类通知,false表示不支持
// ...
}).catch((err) => {
console.error(`[ANS] isSupportTemplate failed, error[${err}]`);
console.error(`[ANS] isSupportTemplate failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -65,7 +65,7 @@
// 发布通知
notificationManager.publish(notificationRequest, (err) => {
if (err) {
console.error(`[ANS] failed to publish, error[${err}]`);
console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`[ANS] publish success `);
......
......@@ -59,10 +59,10 @@
notificationManager.publish(notificationRequest, (err) => {
if (err) {
console.error(`[ANS] failed to publish, error[${err}]`);
console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`[ANS] publish success`);
console.info(`[ANS] publish success.`);
});
```
......@@ -89,10 +89,10 @@
// 发布通知
notificationManager.publish(notificationRequest, (err) => {
if (err) {
console.error(`[ANS] failed to publish, error[${err}]`);
console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`[ANS] publish success`);
console.info(`[ANS] publish success.`);
});
```
......@@ -118,7 +118,7 @@
// 发布通知
notificationManager.publish(notificationRequest, (err) => {
if (err) {
console.error(`[ANS] failed to publish, error[${err}]`);
console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`[ANS] publish success`);
......@@ -149,10 +149,10 @@
// 发布通知
notificationManager.publish(notificationRequest, (err) => {
if (err) {
console.error(`[ANS] failed to publish, error[${err}]`);
console.error(`[ANS] publish failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info(`[ANS] publish success `);
console.info(`[ANS] publish success.`);
});
```
......
......@@ -42,7 +42,7 @@ publish(event: string, callback: AsyncCallback<void>): void
//发布公共事件回调
function publishCB(err) {
if (err.code) {
console.error("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}`);
} else {
console.info("publish");
}
......@@ -84,7 +84,7 @@ let options = {
//发布公共事件回调
function publishCB(err) {
if (err.code) {
console.error("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}`);
} else {
console.info("publish");
}
......@@ -117,19 +117,19 @@ publishAsUser(event: string, userId: number, callback: AsyncCallback<void>): voi
**示例:**
```ts
//发布公共事件回调
// 发布公共事件回调
function publishCB(err) {
if (err.code) {
console.error("publishAsUser failed " + JSON.stringify(err));
console.error(`publishAsUser failed, code is ${err.code}`);
} else {
console.info("publishAsUser");
}
}
//指定发送的用户
// 指定发送的用户
let userId = 100;
//发布公共事件
// 发布公共事件
CommonEvent.publishAsUser("event", userId, publishCB);
```
......@@ -158,25 +158,25 @@ publishAsUser(event: string, userId: number, options: CommonEventPublishData, ca
```ts
//公共事件相关信息
// 公共事件相关信息
let options = {
code: 0, //公共事件的初始代码
data: "initial data",//公共事件的初始数据
code: 0, // 公共事件的初始代码
data: "initial data",// 公共事件的初始数据
}
//发布公共事件回调
// 发布公共事件回调
function publishCB(err) {
if (err.code) {
console.error("publishAsUser failed " + JSON.stringify(err));
console.error(`publishAsUser failed, code is ${err.code}`);
} else {
console.info("publishAsUser");
}
}
//指定发送的用户
// 指定发送的用户
let userId = 100;
//发布公共事件
// 发布公共事件
CommonEvent.publishAsUser("event", userId, options, publishCB);
```
......@@ -201,24 +201,24 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallbac
```ts
let subscriber; //用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作
let subscriber; // 用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作
//订阅者信息
// 订阅者信息
let subscribeInfo = {
events: ["event"]
};
//创建订阅者回调
// 创建订阅者回调
function createCB(err, commonEventSubscriber) {
if (err.code) {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}`);
} else {
console.info("createSubscriber");
subscriber = commonEventSubscriber;
}
}
//创建订阅者
// 创建订阅者
CommonEvent.createSubscriber(subscribeInfo, createCB);
```
......@@ -246,19 +246,19 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise<CommonEventSu
**示例:**
```ts
let subscriber; //用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作
let subscriber; // 用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作
//订阅者信息
// 订阅者信息
let subscribeInfo = {
events: ["event"]
};
//创建订阅者
// 创建订阅者
CommonEvent.createSubscriber(subscribeInfo).then((commonEventSubscriber) => {
console.info("createSubscriber");
subscriber = commonEventSubscriber;
}).catch((err) => {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}`);
});
```
......@@ -282,34 +282,34 @@ subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback<CommonEvent
**示例:**
```ts
let subscriber; //用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作
let subscriber; // 用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作
//订阅者信息
// 订阅者信息
let subscribeInfo = {
events: ["event"]
};
//订阅公共事件回调
// 订阅公共事件回调
function subscribeCB(err, data) {
if (err.code) {
console.error("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}`);
} else {
console.info("subscribe " + JSON.stringify(data));
}
}
//创建订阅者回调
// 创建订阅者回调
function createCB(err, subscriber) {
if (err.code) {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}`);
} else {
console.info("createSubscriber");
//订阅公共事件
// 订阅公共事件
CommonEvent.subscribe(subscriber, subscribeCB);
}
}
//创建订阅者
// 创建订阅者
CommonEvent.createSubscriber(subscribeInfo, createCB);
```
......@@ -333,47 +333,47 @@ unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback<void>):
**示例:**
```ts
let subscriber; //用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作
let subscriber; // 用于保存创建成功的订阅者对象,后续使用其完成订阅及退订的动作
//订阅者信息
// 订阅者信息
let subscribeInfo = {
events: ["event"]
};
//订阅公共事件回调
// 订阅公共事件回调
function subscribeCB(err, data) {
if (err.code) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}`);
} else {
console.info("subscribe " + JSON.stringify(data));
}
}
//创建订阅者回调
// 创建订阅者回调
function createCB(err, commonEventSubscriber) {
if (err.code) {
console.info("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}`);
} else {
console.info("createSubscriber");
subscriber = commonEventSubscriber;
//订阅公共事件
// 订阅公共事件
CommonEvent.subscribe(subscriber, subscribeCB);
}
}
//取消订阅公共事件回调
// 取消订阅公共事件回调
function unsubscribeCB(err) {
if (err.code) {
console.info("unsubscribe failed " + JSON.stringify(err));
console.error(`unsubscribe failed, code is ${err.code}`);
} else {
console.info("unsubscribe");
}
}
//创建订阅者
// 创建订阅者
CommonEvent.createSubscriber(subscribeInfo, createCB);
//取消订阅公共事件
// 取消订阅公共事件
CommonEvent.unsubscribe(subscriber, unsubscribeCB);
```
......@@ -398,12 +398,12 @@ getCode(callback: AsyncCallback<number>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//获取有序公共事件的结果代码回调
// 获取有序公共事件的结果代码回调
function getCodeCB(err, Code) {
if (err.code) {
console.error("getCode failed " + JSON.stringify(err));
console.error(`getCode failed, code is ${err.code}`);
} else {
console.info("getCode " + JSON.stringify(Code));
}
......@@ -430,12 +430,12 @@ getCode(): Promise<number>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.getCode().then((code) => {
console.info("getCode " + JSON.stringify(code));
}).catch((err) => {
console.error("getCode failed " + JSON.stringify(err));
console.error(`getCode failed, code is ${err.code}`);
});
```
......@@ -459,12 +459,12 @@ setCode(code: number, callback: AsyncCallback<void>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//设置有序公共事件的结果代码回调
// 设置有序公共事件的结果代码回调
function setCodeCB(err) {
if (err.code) {
console.error("setCode failed " + JSON.stringify(err));
console.error(`setCode failed, code is ${err.code}`);
} else {
console.info("setCode");
}
......@@ -497,12 +497,12 @@ setCode(code: number): Promise<void>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.setCode(1).then(() => {
console.info("setCode");
}).catch((err) => {
console.error("setCode failed " + JSON.stringify(err));
console.error(`setCode failed, code is ${err.code}`);
});
```
......@@ -525,12 +525,12 @@ getData(callback: AsyncCallback<string>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//获取有序公共事件的结果数据回调
// 获取有序公共事件的结果数据回调
function getDataCB(err, data) {
if (err.code) {
console.error("getData failed " + JSON.stringify(err));
console.error(`getData failed, code is ${err.code}`);
} else {
console.info("getData " + JSON.stringify(data));
}
......@@ -558,12 +558,12 @@ getData(): Promise<string>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.getData().then((data) => {
console.info("getData " + JSON.stringify(data));
}).catch((err) => {
console.error("getData failed " + JSON.stringify(err));
console.error(`getData failed, code is ${err.code}`);
});
```
......@@ -587,12 +587,12 @@ setData(data: string, callback: AsyncCallback<void>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//设置有序公共事件的结果数据回调
// 设置有序公共事件的结果数据回调
function setDataCB(err) {
if (err.code) {
console.error("setData failed " + JSON.stringify(err));
console.error(`sendData failed, code is ${err.code}`);
} else {
console.info("setData");
}
......@@ -625,12 +625,12 @@ setData(data: string): Promise<void>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.setData("publish_data_changed").then(() => {
console.info("setData");
}).catch((err) => {
console.error("setData failed " + JSON.stringify(err));
console.error(`setData failed, code is ${err.code}`);
});
```
......@@ -655,12 +655,12 @@ setCodeAndData(code: number, data: string, callback:AsyncCallback<void>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//设置有序公共事件的结果代码和结果数据回调
// 设置有序公共事件的结果代码和结果数据回调
function setCodeDataCB(err) {
if (err.code) {
console.error("setCodeAndData failed " + JSON.stringify(err));
console.error(`setCodeAndData failed, code is ${err.code}`);
} else {
console.info("setCodeDataCallback");
}
......@@ -695,12 +695,12 @@ setCodeAndData(code: number, data: string): Promise<void>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
console.info("setCodeAndData");
}).catch((err) => {
console.info("setCodeAndData failed " + JSON.stringify(err));
console.error(`setCodeAndData failed, code is ${err.code}`);
});
```
......@@ -725,12 +725,12 @@ isOrderedCommonEvent(callback: AsyncCallback<boolean>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//获取当前公共事件是否为有序事件的回调
// 获取当前公共事件是否为有序事件的回调
function isOrderedCB(err, isOrdered) {
if (err.code) {
console.error("isOrderedCommonEvent failed " + JSON.stringify(err));
console.error(`isOrderedCommonEvent failed, code is ${err.code}`);
} else {
console.info("isOrdered " + JSON.stringify(isOrdered));
}
......@@ -759,12 +759,12 @@ isOrderedCommonEvent(): Promise<boolean>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.isOrderedCommonEvent().then((isOrdered) => {
console.info("isOrdered " + JSON.stringify(isOrdered));
}).catch((err) => {
console.error("isOrdered failed " + JSON.stringify(err));
console.error(`isOrderedCommonEvent failed, code is ${err.code}`);
});
```
......@@ -789,12 +789,12 @@ isStickyCommonEvent(callback: AsyncCallback<boolean>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//获取当前公共事件是否为粘性事件的回调
// 获取当前公共事件是否为粘性事件的回调
function isStickyCB(err, isSticky) {
if (err.code) {
console.error("isStickyCommonEvent failed " + JSON.stringify(err));
console.error(`isStickyCommonEvent failed, code is ${err.code}`);
} else {
console.info("isSticky " + JSON.stringify(isSticky));
}
......@@ -823,12 +823,12 @@ isStickyCommonEvent(): Promise<boolean>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.isStickyCommonEvent().then((isSticky) => {
console.info("isSticky " + JSON.stringify(isSticky));
}).catch((err) => {
console.error("isSticky failed " + JSON.stringify(err));
console.error(`isSticky failed, code is ${err.code}`);
});
```
......@@ -851,12 +851,12 @@ abortCommonEvent(callback: AsyncCallback<void>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//取消当前有序公共事件的回调
// 取消当前有序公共事件的回调
function abortCB(err) {
if (err.code) {
console.error("abortCommonEvent failed " + JSON.stringify(err));
console.error(`abortCommonEvent failed, code is ${err.code}`);
} else {
console.info("abortCommonEvent");
}
......@@ -884,12 +884,12 @@ abortCommonEvent(): Promise<void>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.abortCommonEvent().then(() => {
console.info("abortCommonEvent");
}).catch((err) => {
console.error("abortCommonEvent failed " + JSON.stringify(err));
console.error(`abortCommonEvent failed, code is ${err.code}`);
});
```
......@@ -912,12 +912,12 @@ clearAbortCommonEvent(callback: AsyncCallback<void>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//清除当前公共事件取消状态的回调
// 清除当前公共事件取消状态的回调
function clearAbortCB(err) {
if (err.code) {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err));
console.error(`clearAbortCommonEvent failed, code is ${err.code}`);
} else {
console.info("clearAbortCommonEvent");
}
......@@ -945,12 +945,12 @@ clearAbortCommonEvent(): Promise<void>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.clearAbortCommonEvent().then(() => {
console.info("clearAbortCommonEvent");
}).catch((err) => {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err));
console.error(`clearAbortCommonEvent failed, code is ${err.code}`);
});
```
......@@ -973,12 +973,12 @@ getAbortCommonEvent(callback: AsyncCallback<boolean>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//获取当前有序公共事件是否取消的回调
// 获取当前有序公共事件是否取消的回调
function getAbortCB(err, abortEvent) {
if (err.code) {
console.error("getAbortCommonEvent failed " + JSON.stringify(err));
console.error(`getAbortCommonEvent failed, code is ${err.code}`);
} else {
console.info("abortEvent " + abortEvent)
}
......@@ -1006,12 +1006,12 @@ getAbortCommonEvent(): Promise<boolean>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.getAbortCommonEvent().then((abortCommonEvent) => {
console.info("abortCommonEvent " + JSON.stringify(abortCommonEvent));
}).catch((err) => {
console.error("getAbortCommonEvent failed " + JSON.stringify(err));
console.error(`getAbortCommonEvent failed, code is ${err.code}`);
});
```
......@@ -1034,12 +1034,12 @@ getSubscribeInfo(callback: AsyncCallback<CommonEventSubscribeInfo>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//获取订阅者信息回调
// 获取订阅者信息回调
function getCB(err, subscribeInfo) {
if (err.code) {
console.error("getSubscribeInfo failed " + JSON.stringify(err));
console.error(`getSubscribeInfo failed, code is ${err.code}`);
} else {
console.info("SubscribeInfo " + JSON.stringify(subscribeInfo));
}
......@@ -1067,12 +1067,12 @@ getSubscribeInfo(): Promise<CommonEventSubscribeInfo>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.getSubscribeInfo().then((subscribeInfo) => {
console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}).catch((err) => {
console.error("getSubscribeInfo failed " + JSON.stringify(err));
console.error(`getSubscribeInfo failed, code is ${err.code}`);
});
```
......@@ -1095,12 +1095,12 @@ finishCommonEvent(callback: AsyncCallback<void>): void
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
//结束当前有序公共事件的回调
// 结束当前有序公共事件的回调
function finishCB(err) {
if (err.code) {
console.error("finishCommonEvent failed " + JSON.stringify(err));
console.error(`finishCommonEvent failed, code is ${err.code}`);
} else {
console.info("FinishCommonEvent");
}
......@@ -1128,12 +1128,12 @@ finishCommonEvent(): Promise<void>
**示例:**
```ts
let subscriber; //创建成功的订阅者对象
let subscriber; // 创建成功的订阅者对象
subscriber.finishCommonEvent().then(() => {
console.info("FinishCommonEvent");
}).catch((err) => {
console.error("finishCommonEvent failed " + JSON.stringify(err));
console.error(`finishCommonEvent failed, code is ${err.code}`);
});
```
......
......@@ -45,7 +45,7 @@ publish(event: string, callback: AsyncCallback<void>): void
//发布公共事件回调
function publishCB(err) {
if (err) {
console.error("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publish");
}
......@@ -55,7 +55,7 @@ function publishCB(err) {
try {
CommonEventManager.publish("event", publishCB);
} catch(err) {
console.error('publish failed, catch error' + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
}
```
......@@ -94,7 +94,7 @@ let options = {
//发布公共事件回调
function publishCB(err) {
if (err) {
console.error("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publish");
}
......@@ -104,7 +104,7 @@ function publishCB(err) {
try {
CommonEventManager.publish("event", options, publishCB);
} catch (err) {
console.error('publish failed, catch error' + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
}
```
......@@ -138,7 +138,7 @@ publishAsUser(event: string, userId: number, callback: AsyncCallback<void>): voi
//发布公共事件回调
function publishCB(err) {
if (err) {
console.error("publishAsUser failed " + JSON.stringify(err));
console.error(`publishAsUser failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publishAsUser");
}
......@@ -151,7 +151,7 @@ let userId = 100;
try {
CommonEventManager.publishAsUser("event", userId, publishCB);
} catch (err) {
console.error('publishAsUser failed, catch error' + JSON.stringify(err));
console.error(`publishAsUser failed, code is ${err.code}, message is ${err.message}`);
}
```
......@@ -193,7 +193,7 @@ let options = {
//发布公共事件回调
function publishCB(err) {
if (err) {
console.error("publishAsUser failed " + JSON.stringify(err));
console.error(`publishAsUser failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publishAsUser");
}
......@@ -206,7 +206,7 @@ let userId = 100;
try {
CommonEventManager.publishAsUser("event", userId, options, publishCB);
} catch (err) {
console.error('publishAsUser failed, catch error' + JSON.stringify(err));
console.error(`publishAsUser failed, code is ${err.code}, message is ${err.message}`);
}
```
......@@ -244,7 +244,7 @@ function createCB(err, commonEventSubscriber) {
console.info("createSubscriber");
subscriber = commonEventSubscriber;
} else {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
}
}
......@@ -252,7 +252,7 @@ function createCB(err, commonEventSubscriber) {
try {
CommonEventManager.createSubscriber(subscribeInfo, createCB);
} catch (err) {
console.error('createSubscriber failed, catch error' + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
}
```
......@@ -292,7 +292,7 @@ CommonEventManager.createSubscriber(subscribeInfo).then((commonEventSubscriber)
console.info("createSubscriber");
subscriber = commonEventSubscriber;
}).catch((err) => {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -328,7 +328,7 @@ let subscribeInfo = {
//订阅公共事件回调
function SubscribeCB(err, data) {
if (err.code) {
console.error("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribe ");
}
......@@ -342,10 +342,10 @@ function createCB(err, subscriber) {
try {
CommonEventManager.subscribe(subscriber, SubscribeCB);
} catch (err) {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
}
} else {
console.error("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
}
}
......@@ -353,7 +353,7 @@ function createCB(err, subscriber) {
try {
CommonEventManager.createSubscriber(subscribeInfo, createCB);
} catch (err) {
console.error('createSubscriber failed, catch error' + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
}
```
......@@ -385,7 +385,7 @@ let subscribeInfo = {
//订阅公共事件回调
function subscribeCB(err, data) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribe");
}
......@@ -393,21 +393,21 @@ function subscribeCB(err, data) {
//创建订阅者回调
function createCB(err, subscriber) {
if (err) {
console.info("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("createSubscriber");
//订阅公共事件
try {
CommonEventManager.subscribe(subscriber, subscribeCB);
} catch(err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
}
}
}
//取消订阅公共事件回调
function unsubscribeCB(err) {
if (err) {
console.info("unsubscribe failed " + JSON.stringify(err));
console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("unsubscribe");
}
......@@ -416,14 +416,14 @@ function unsubscribeCB(err) {
try {
CommonEventManager.createSubscriber(subscribeInfo, createCB);
} catch (err) {
console.info("createSubscriber failed " + JSON.stringify(err));
console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`);
}
//取消订阅公共事件
try {
CommonEventManager.unsubscribe(subscriber, unsubscribeCB);
} catch (err) {
console.info("unsubscribe failed " + JSON.stringify(err));
console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
}
```
......@@ -453,7 +453,7 @@ let subscriber; //创建成功的订阅者对象
//获取有序公共事件代码回调
function getCodeCB(err, code) {
if (err.code) {
console.error("getCode failed " + JSON.stringify(err));
console.error(`getCode failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getCode " + JSON.stringify(code));
}
......@@ -485,7 +485,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.getCode().then((code) => {
console.info("getCode " + JSON.stringify(code));
}).catch((err) => {
console.error("getCode failed " + JSON.stringify(err));
console.error(`getCode failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -514,7 +514,7 @@ let subscriber; //创建成功的订阅者对象
//设置有序公共事件的代码回调
function setCodeCB(err) {
if (err.code) {
console.error("setCode failed " + JSON.stringify(err));
console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setCode");
}
......@@ -552,7 +552,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.setCode(1).then(() => {
console.info("setCode");
}).catch((err) => {
console.error("setCode failed " + JSON.stringify(err));
console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -580,7 +580,7 @@ let subscriber; //创建成功的订阅者对象
//获取有序公共事件代码数据回调
function getDataCB(err, data) {
if (err.code) {
console.error("getData failed " + JSON.stringify(err));
console.error(`getData failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getData " + JSON.stringify(data));
}
......@@ -612,7 +612,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.getData().then((data) => {
console.info("getData " + JSON.stringify(data));
}).catch((err) => {
console.error("getData failed " + JSON.stringify(err));
console.error(`getData failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -639,7 +639,7 @@ let subscriber; //创建成功的订阅者对象
//设置有序公共事件的结果数据回调
function setDataCB(err) {
if (err.code) {
console.error("setData failed " + JSON.stringify(err));
console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setData");
}
......@@ -677,7 +677,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.setData("publish_data_changed").then(() => {
console.info("setData");
}).catch((err) => {
console.error("setData failed " + JSON.stringify(err));
console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -707,7 +707,7 @@ let subscriber; //创建成功的订阅者对象
//设置有序公共事件的代码和数据回调
function setCodeDataCB(err) {
if (err.code) {
console.error("setCodeAndData failed " + JSON.stringify(err));
console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setCodeDataCallback");
}
......@@ -746,7 +746,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
console.info("setCodeAndData");
}).catch((err) => {
console.info("setCodeAndData failed " + JSON.stringify(err));
console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -776,7 +776,7 @@ let subscriber; //创建成功的订阅者对象
//获取当前公共事件是否为有序事件的回调
function isOrderedCB(err, isOrdered) {
if (err.code) {
console.error("isOrderedCommonEvent failed " + JSON.stringify(err));
console.error(`isOrderedCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isOrdered " + JSON.stringify(isOrdered));
}
......@@ -810,7 +810,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.isOrderedCommonEvent().then((isOrdered) => {
console.info("isOrdered " + JSON.stringify(isOrdered));
}).catch((err) => {
console.error("isOrdered failed " + JSON.stringify(err));
console.error(`isOrdered failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -840,7 +840,7 @@ let subscriber; //创建成功的订阅者对象
//获取当前公共事件是否为粘性事件的回调
function isStickyCB(err, isSticky) {
if (err.code) {
console.error("isStickyCommonEvent failed " + JSON.stringify(err));
console.error(`isStickyCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isSticky " + JSON.stringify(isSticky));
}
......@@ -874,7 +874,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.isStickyCommonEvent().then((isSticky) => {
console.info("isSticky " + JSON.stringify(isSticky));
}).catch((err) => {
console.error("isSticky failed " + JSON.stringify(err));
console.error(`isSticky failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -902,7 +902,7 @@ let subscriber; //创建成功的订阅者对象
//取消当前有序公共事件的回调
function abortCB(err) {
if (err.code) {
console.error("abortCommonEvent failed " + JSON.stringify(err));
console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("abortCommonEvent");
}
......@@ -934,7 +934,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.abortCommonEvent().then(() => {
console.info("abortCommonEvent");
}).catch((err) => {
console.error("abortCommonEvent failed " + JSON.stringify(err));
console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -962,7 +962,7 @@ let subscriber; //创建成功的订阅者对象
//清除当前公共事件取消状态的回调
function clearAbortCB(err) {
if (err.code) {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err));
console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("clearAbortCommonEvent");
}
......@@ -994,7 +994,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.clearAbortCommonEvent().then(() => {
console.info("clearAbortCommonEvent");
}).catch((err) => {
console.error("clearAbortCommonEvent failed " + JSON.stringify(err));
console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -1022,7 +1022,7 @@ let subscriber; //创建成功的订阅者对象
//获取当前有序公共事件是否取消的回调
function getAbortCB(err, abortEvent) {
if (err.code) {
console.error("getAbortCommonEvent failed " + JSON.stringify(err));
console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("abortCommonEvent " + abortEvent)
}
......@@ -1054,7 +1054,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.getAbortCommonEvent().then((abortEvent) => {
console.info("abortCommonEvent " + JSON.stringify(abortEvent));
}).catch((err) => {
console.error("getAbortCommonEvent failed " + JSON.stringify(err));
console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -1082,7 +1082,7 @@ let subscriber; //创建成功的订阅者对象
//获取订阅者信息回调
function getCB(err, subscribeInfo) {
if (err.code) {
console.error("getSubscribeInfo failed " + JSON.stringify(err));
console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}
......@@ -1114,7 +1114,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.getSubscribeInfo().then((subscribeInfo) => {
console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
}).catch((err) => {
console.error("getSubscribeInfo failed " + JSON.stringify(err));
console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`);
});
```
......@@ -1142,11 +1142,11 @@ let subscriber; //创建成功的订阅者对象
//结束当前有序公共事件的回调
function finishCB(err) {
if (err.code) {
console.error("finishCommonEvent failed " + JSON.stringify(err));
console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("FinishCommonEvent");
}
}
subscriber.finishCommonEvent(finishCB);
```
......@@ -1174,7 +1174,7 @@ let subscriber; //创建成功的订阅者对象
subscriber.finishCommonEvent().then(() => {
console.info("FinishCommonEvent");
}).catch((err) => {
console.error("finishCommonEvent failed " + JSON.stringify(err));
console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`);
});
```
......
......@@ -35,7 +35,7 @@ publish(request: NotificationRequest, callback: AsyncCallback\<void\>): void
// publish回调
function publishCallback(err) {
if (err.code) {
console.info("publish failed " + JSON.stringify(err));
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.info("publish failed " + JSON.stringify(err));
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
......
......@@ -44,7 +44,7 @@ publish(request: NotificationRequest, callback: AsyncCallback\<void\>): void
//publish回调
function publishCallback(err) {
if (err) {
console.info("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publish success");
}
......@@ -148,7 +148,7 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<v
// publish回调
function publishCallback(err) {
if (err) {
console.info("publish failed " + JSON.stringify(err));
console.error(`publish failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publish success");
}
......@@ -255,7 +255,7 @@ cancel(id: number, label: string, callback: AsyncCallback\<void\>): void
// cancel回调
function cancelCallback(err) {
if (err) {
console.info("cancel failed " + JSON.stringify(err));
console.error(`cancel failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("cancel success");
}
......@@ -325,7 +325,7 @@ cancel(id: number, callback: AsyncCallback\<void\>): void
// cancel回调
function cancelCallback(err) {
if (err) {
console.info("cancel failed " + JSON.stringify(err));
console.error(`cancel failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("cancel success");
}
......@@ -361,7 +361,7 @@ cancelAll(callback: AsyncCallback\<void\>): void
// cancel回调
function cancelAllCallback(err) {
if (err) {
console.info("cancelAll failed " + JSON.stringify(err));
console.error(`cancelAll failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("cancelAll success");
}
......@@ -426,7 +426,7 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\<void\>): void
// addslot回调
function addSlotCallBack(err) {
if (err) {
console.info("addSlot failed " + JSON.stringify(err));
console.error(`addSlot failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("addSlot success");
}
......@@ -505,7 +505,7 @@ addSlot(type: SlotType, callback: AsyncCallback\<void\>): void
// addslot回调
function addSlotCallBack(err) {
if (err) {
console.info("addSlot failed " + JSON.stringify(err));
console.error(`addSlot failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("addSlot success");
}
......@@ -576,7 +576,7 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi
// addSlots回调
function addSlotsCallBack(err) {
if (err) {
console.info("addSlots failed " + JSON.stringify(err));
console.error(`addSlots failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("addSlots success");
}
......@@ -663,7 +663,7 @@ getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot\>): void
// getSlot回调
function getSlotCallback(err,data) {
if (err) {
console.info("getSlot failed " + JSON.stringify(err));
console.error(`getSlot failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getSlot success");
}
......@@ -737,7 +737,7 @@ getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void
// getSlots回调
function getSlotsCallback(err,data) {
if (err) {
console.info("getSlots failed " + JSON.stringify(err));
console.error(`getSlots failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getSlots success");
}
......@@ -804,7 +804,7 @@ removeSlot(slotType: SlotType, callback: AsyncCallback\<void\>): void
// removeSlot回调
function removeSlotCallback(err) {
if (err) {
console.info("removeSlot failed " + JSON.stringify(err));
console.error(`removeSlot failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeSlot success");
}
......@@ -871,7 +871,7 @@ removeAllSlots(callback: AsyncCallback\<void\>): void
```ts
function removeAllCallBack(err) {
if (err) {
console.info("removeAllSlots failed " + JSON.stringify(err));
console.error(`removeAllSlots failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeAllSlots success");
}
......@@ -937,7 +937,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall
```ts
function setNotificationEnablenCallback(err) {
if (err) {
console.info("setNotificationEnablenCallback failed " + JSON.stringify(err));
console.error(`setNotificationEnablenCallback failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setNotificationEnablenCallback success");
}
......@@ -1020,7 +1020,7 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>):
```ts
function isNotificationEnabledCallback(err, data) {
if (err) {
console.info("isNotificationEnabled failed " + JSON.stringify(err));
console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isNotificationEnabled success");
}
......@@ -1106,7 +1106,7 @@ isNotificationEnabled(callback: AsyncCallback\<boolean\>): void
```ts
function isNotificationEnabledCallback(err, data) {
if (err) {
console.info("isNotificationEnabled failed " + JSON.stringify(err));
console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isNotificationEnabled success");
}
......@@ -1190,7 +1190,7 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<voi
```ts
function displayBadgeCallback(err) {
if (err) {
console.info("displayBadge failed " + JSON.stringify(err));
console.error(`displayBadge failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("displayBadge success");
}
......@@ -1273,7 +1273,7 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
```ts
function isBadgeDisplayedCallback(err, data) {
if (err) {
console.info("isBadgeDisplayed failed " + JSON.stringify(err));
console.error(`isBadgeDisplayed failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isBadgeDisplayed success");
}
......@@ -1362,7 +1362,7 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal
```ts
function setSlotByBundleCallback(err) {
if (err) {
console.info("setSlotByBundle failed " + JSON.stringify(err));
console.error(`setSlotByBundle failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setSlotByBundle success");
}
......@@ -1451,7 +1451,7 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<Notificati
```ts
function getSlotsByBundleCallback(err, data) {
if (err) {
console.info("getSlotsByBundle failed " + JSON.stringify(err));
console.error(`getSlotByBundle failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getSlotsByBundle success");
}
......@@ -1539,7 +1539,7 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): voi
```ts
function getSlotNumByBundleCallback(err, data) {
if (err) {
console.info("getSlotNumByBundle failed " + JSON.stringify(err));
console.error(`getSlotByBundle failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getSlotNumByBundle success");
}
......@@ -1626,7 +1626,7 @@ getAllActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>)
```ts
function getAllActiveNotificationsCallback(err, data) {
if (err) {
console.info("getAllActiveNotifications failed " + JSON.stringify(err));
console.error(`getAllActiveNotifications failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getAllActiveNotifications success");
}
......@@ -1696,7 +1696,7 @@ getActiveNotificationCount(callback: AsyncCallback\<number\>): void
```ts
function getActiveNotificationCountCallback(err, data) {
if (err) {
console.info("getActiveNotificationCount failed " + JSON.stringify(err));
console.error(`getActiveNotificationCount failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getActiveNotificationCount success");
}
......@@ -1762,7 +1762,7 @@ getActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): v
```ts
function getActiveNotificationsCallback(err, data) {
if (err) {
console.info("getActiveNotifications failed " + JSON.stringify(err));
console.error(`getActiveNotifications failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getActiveNotifications success");
}
......@@ -1829,7 +1829,7 @@ cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void
```ts
function cancelGroupCallback(err) {
if (err) {
console.info("cancelGroup failed " + JSON.stringify(err));
console.error(`cancelGroup failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("cancelGroup success");
}
......@@ -1905,7 +1905,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall
```ts
function removeGroupByBundleCallback(err) {
if (err) {
console.info("removeGroupByBundle failed " + JSON.stringify(err));
console.error(`removeGroupByBundle failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeGroupByBundle success");
}
......@@ -1987,7 +1987,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): vo
```ts
function setDoNotDisturbDateCallback(err) {
if (err) {
console.info("setDoNotDisturbDate failed " + JSON.stringify(err));
console.error(`setDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setDoNotDisturbDate success");
}
......@@ -2076,7 +2076,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb
```ts
function setDoNotDisturbDateCallback(err) {
if (err) {
console.info("setDoNotDisturbDate failed " + JSON.stringify(err));
console.error(`setDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setDoNotDisturbDate success");
}
......@@ -2169,7 +2169,7 @@ getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void
```ts
function getDoNotDisturbDateCallback(err,data) {
if (err) {
console.info("getDoNotDisturbDate failed " + JSON.stringify(err));
console.error(`getDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getDoNotDisturbDate success");
}
......@@ -2246,7 +2246,7 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>)
```ts
function getDoNotDisturbDateCallback(err,data) {
if (err) {
console.info("getDoNotDisturbDate failed " + JSON.stringify(err));
console.error(`getDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getDoNotDisturbDate success");
}
......@@ -2332,7 +2332,7 @@ supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void
```ts
function supportDoNotDisturbModeCallback(err,data) {
if (err) {
console.info("supportDoNotDisturbMode failed " + JSON.stringify(err));
console.error(`supportDoNotDisturbMode failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("supportDoNotDisturbMode success");
}
......@@ -2405,7 +2405,7 @@ isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean\>): voi
let templateName = 'process';
function isSupportTemplateCallback(err, data) {
if (err) {
console.info("isSupportTemplate failed " + JSON.stringify(err));
console.error(`isSupportTemplate failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isSupportTemplate success");
}
......@@ -2480,7 +2480,7 @@ requestEnableNotification(callback: AsyncCallback\<void\>): void
```javascript
function requestEnableNotificationCallback(err) {
if (err) {
console.info("requestEnableNotification failed " + JSON.stringify(err));
console.error(`requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("requestEnableNotification success");
}
......@@ -2548,7 +2548,7 @@ setDistributedEnable(enable: boolean, callback: AsyncCallback\<void\>): void
```javascript
function setDistributedEnableCallback() {
if (err) {
console.info("setDistributedEnable failed " + JSON.stringify(err));
console.error(`setDistributedEnable failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setDistributedEnable success");
}
......@@ -2625,7 +2625,7 @@ isDistributedEnabled(callback: AsyncCallback\<boolean>): void
```javascript
function isDistributedEnabledCallback(err, data) {
if (err) {
console.info("isDistributedEnabled failed " + JSON.stringify(err));
console.error(`isDistributedEnabled failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isDistributedEnabled success " + JSON.stringify(data));
}
......@@ -2704,7 +2704,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As
```javascript
function setDistributedEnableByBundleCallback(err) {
if (err) {
console.info("enableDistributedByBundle failed " + JSON.stringify(err));
console.error(`setDistributedEnableByBundle failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("enableDistributedByBundle success");
}
......@@ -2798,7 +2798,7 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<bool
```javascript
function isDistributedEnabledByBundleCallback(data) {
if (err) {
console.info("isDistributedEnabledByBundle failed " + JSON.stringify(err));
console.error(`isDistributedEnabledByBundle failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isDistributedEnabledByBundle success" + JSON.stringify(data));
}
......@@ -2889,7 +2889,7 @@ getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType\>): void
```javascript
function getDeviceRemindTypeCallback(err, data) {
if (err) {
console.info("getDeviceRemindType failed " + JSON.stringify(err));
console.error(`getDeviceRemindType failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("getDeviceRemindType success");
}
......@@ -2972,7 +2972,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
//publishAsBundle回调
function callback(err) {
if (err) {
console.info("publishAsBundle failed " + JSON.stringify(err));
console.error(`publishAsBundle failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("publishAsBundle success");
}
......@@ -3094,7 +3094,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac
// cancelAsBundle
function cancelAsBundleCallback(err) {
if (err) {
console.info("cancelAsBundle failed " + JSON.stringify(err));
console.error(`cancelAsBundle failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("cancelAsBundle success");
}
......@@ -3188,7 +3188,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean,
// setNotificationEnableSlot
function setNotificationEnableSlotCallback(err) {
if (err) {
console.info("setNotificationEnableSlot failed " + JSON.stringify(err));
console.error(`setNotificationEnableSlot failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setNotificationEnableSlot success");
}
......@@ -3277,7 +3277,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC
// isNotificationSlotEnabled
function getEnableSlotCallback(err, data) {
if (err) {
console.info("isNotificationSlotEnabled failed " + JSON.stringify(err));
console.error(`isNotificationSlotEnabled failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("isNotificationSlotEnabled success");
}
......@@ -3371,7 +3371,7 @@ let enable = true;
function callback(err) {
if (err) {
console.info("setSyncNotificationEnabledWithoutApp failed " + JSON.stringify(err));
console.error(`setSyncNotificationEnabledWithoutApp failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("setSyncNotificationEnabledWithoutApp success");
}
......@@ -3424,7 +3424,7 @@ let enable = true;
notificationManager.setSyncNotificationEnabledWithoutApp(userId, enable).then(() => {
console.info('setSyncNotificationEnabledWithoutApp success');
}).catch((err) => {
console.info('setSyncNotificationEnabledWithoutApp, err:' + JSON.stringify(err));
console.error(`setSyncNotificationEnabledWithoutApp failed, code is ${err.code}, message is ${err.message}`);
});
```
......
......@@ -48,7 +48,7 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c
//subscribe回调
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribe success");
}
......@@ -97,7 +97,7 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>):
```js
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribe success");
}
......@@ -188,7 +188,7 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void\>)
```js
function unsubscribeCallback(err) {
if (err) {
console.info("unsubscribe failed " + JSON.stringify(err));
console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("unsubscribe success");
}
......@@ -278,7 +278,7 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
```js
function removeCallback(err) {
if (err) {
console.info("remove failed " + JSON.stringify(err));
console.error(`remove failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("remove success");
}
......@@ -378,7 +378,7 @@ let hashCode = 'hashCode';
function removeCallback(err) {
if (err) {
console.info("remove failed " + JSON.stringify(err));
console.error(`remove failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("remove success");
}
......@@ -458,7 +458,7 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\<void\>): void
```js
function removeAllCallback(err) {
if (err) {
console.info("removeAll failed " + JSON.stringify(err));
console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeAll success");
}
......@@ -500,7 +500,7 @@ removeAll(callback: AsyncCallback\<void\>): void
```js
function removeAllCallback(err) {
if (err) {
console.info("removeAll failed " + JSON.stringify(err));
console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeAll success");
}
......@@ -578,7 +578,7 @@ removeAll(userId: number, callback: AsyncCallback\<void>): void
```js
function removeAllCallback(err) {
if (err) {
console.info("removeAll failed " + JSON.stringify(err));
console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeAll success");
}
......@@ -621,7 +621,7 @@ removeAll(userId: number): Promise\<void>
```js
function removeAllCallback(err) {
if (err) {
console.info("removeAll failed " + JSON.stringify(err));
console.error(`removeAll failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("removeAll success");
}
......@@ -659,7 +659,7 @@ onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -699,7 +699,7 @@ onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -739,7 +739,7 @@ onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -771,7 +771,7 @@ onConnect?:() => void
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -803,14 +803,14 @@ onDisconnect?:() => void
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
};
function unsubscribeCallback(err) {
if (err.code) {
console.info("unsubscribe failed " + JSON.stringify(err));
console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("unsubscribeCallback");
}
......@@ -849,7 +849,7 @@ onDestroy?:() => void
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -887,7 +887,7 @@ onDoNotDisturbDateChange?:(mode: notification.[DoNotDisturbDate](js-apis-notific
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......@@ -926,7 +926,7 @@ onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](#
```javascript
function subscribeCallback(err) {
if (err) {
console.info("subscribe failed " + JSON.stringify(err));
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribeCallback");
}
......
......@@ -84,13 +84,13 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
try {
accountManager.activateOsAccount(localId, (err)=>{
if (err) {
console.log("activateOsAccount failed, error:" + JSON.stringify(err));
console.error(`activateOsAccount failed, code is ${err.code}, message is ${err.message}`);
} else {
console.log("activateOsAccount successfully");
}
});
} catch (err) {
console.log("activateOsAccount exception:" + JSON.stringify(err));
console.error(`activateOsAccount failed, code is ${err.code}, message is ${err.message}`);
}
```
......@@ -170,13 +170,13 @@ checkMultiOsAccountEnabled(callback: AsyncCallback&lt;boolean&gt;): void
try {
accountManager.checkMultiOsAccountEnabled((err, isEnabled) => {
if (err) {
console.log("checkMultiOsAccountEnabled failed, error: " + JSON.stringify(err));
console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
} else {
console.log("checkMultiOsAccountEnabled successfully, isEnabled: " + isEnabled);
}
});
} catch (err) {
console.log("checkMultiOsAccountEnabled exception: " + JSON.stringify(err));
console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
}
```
......@@ -208,10 +208,10 @@ checkMultiOsAccountEnabled(): Promise&lt;boolean&gt;
accountManager.checkMultiOsAccountEnabled().then((isEnabled) => {
console.log('checkMultiOsAccountEnabled successfully, isEnabled: ' + isEnabled);
}).catch((err) => {
console.log('checkMultiOsAccountEnabled failed, error: ' + JSON.stringify(err));
console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
});
} catch (err) {
console.log('checkMultiOsAccountEnabled exception: ' + JSON.stringify(err));
console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
}
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册