Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
97aba69a
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
97aba69a
编写于
1月 08, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 08, 2023
浏览文件
操作
浏览文件
下载
差异文件
!13343 通知接口文档修改
Merge pull request !13343 from FangJinliang/pr_0107
上级
a8b46c68
e87781e4
变更
5
展开全部
隐藏空白更改
内联
并排
Showing
5 changed file
with
299 addition
and
299 deletion
+299
-299
zh-cn/application-dev/notification/notification-with-wantagent.md
...plication-dev/notification/notification-with-wantagent.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-notification.md
zh-cn/application-dev/reference/apis/js-apis-notification.md
+148
-148
zh-cn/application-dev/reference/apis/js-apis-notificationManager.md
...ication-dev/reference/apis/js-apis-notificationManager.md
+110
-110
zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md
...ation-dev/reference/apis/js-apis-notificationSubscribe.md
+36
-36
zh-cn/application-dev/reference/apis/js-apis-system-notification.md
...ication-dev/reference/apis/js-apis-system-notification.md
+3
-3
未找到文件。
zh-cn/application-dev/notification/notification-with-wantagent.md
浏览文件 @
97aba69a
...
...
@@ -35,7 +35,7 @@
3.
创建WantAgentInfo信息。
场景一:创建拉起UIAbility的WantAgent的
WantAgentInfo
信息。
场景一:创建拉起UIAbility的WantAgent的
[
WantAgentInfo
](
../reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md
)
信息。
```
typescript
let
wantAgentObj
=
null
;
// 用于保存创建成功的wantAgent对象,后续使用其完成触发的动作。
...
...
@@ -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
let
wantAgentObj
=
null
;
// 用于保存创建成功的WantAgent对象,后续使用其完成触发的动作。
...
...
zh-cn/application-dev/reference/apis/js-apis-notification.md
浏览文件 @
97aba69a
此差异已折叠。
点击以展开。
zh-cn/application-dev/reference/apis/js-apis-notificationManager.md
浏览文件 @
97aba69a
...
...
@@ -50,7 +50,7 @@ function publishCallback(err) {
}
}
//通知Request对象
var
notificationRequest
=
{
let
notificationRequest
=
{
id
:
1
,
content
:
{
contentType
:
Notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
...
...
@@ -60,8 +60,8 @@ var notificationRequest = {
additionalText
:
"
test_additionalText
"
}
}
}
Notification
.
publish
(
notificationRequest
,
publishCallback
)
}
;
Notification
.
publish
(
notificationRequest
,
publishCallback
)
;
```
...
...
@@ -95,7 +95,7 @@ publish(request: NotificationRequest): Promise\<void\>
```
js
// 通知Request对象
var
notificationRequest
=
{
let
notificationRequest
=
{
notificationId
:
1
,
content
:
{
contentType
:
Notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
...
...
@@ -105,7 +105,7 @@ var notificationRequest = {
additionalText
:
"
test_additionalText
"
}
}
}
}
;
Notification
.
publish
(
notificationRequest
).
then
(()
=>
{
console
.
info
(
"
publish success
"
);
});
...
...
@@ -156,9 +156,9 @@ function publishCallback(err) {
}
}
// 用户ID
var
userId
=
1
let
userId
=
1
;
// 通知Request对象
var
notificationRequest
=
{
let
notificationRequest
=
{
id
:
1
,
content
:
{
contentType
:
Notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
...
...
@@ -168,7 +168,7 @@ var notificationRequest = {
additionalText
:
"
test_additionalText
"
}
}
}
}
;
Notification
.
publish
(
notificationRequest
,
userId
,
publishCallback
);
```
...
...
@@ -206,7 +206,7 @@ publish(request: NotificationRequest, userId: number): Promise\<void\>
**示例:**
```
js
var
notificationRequest
=
{
let
notificationRequest
=
{
notificationId
:
1
,
content
:
{
contentType
:
Notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
...
...
@@ -216,9 +216,9 @@ var notificationRequest = {
additionalText
:
"
test_additionalText
"
}
}
}
}
;
var
userId
=
1
let
userId
=
1
;
Notification
.
publish
(
notificationRequest
,
userId
).
then
(()
=>
{
console
.
info
(
"
publish success
"
);
...
...
@@ -262,7 +262,7 @@ function cancelCallback(err) {
console
.
info
(
"
cancel success
"
);
}
}
Notification
.
cancel
(
0
,
"
label
"
,
cancelCallback
)
Notification
.
cancel
(
0
,
"
label
"
,
cancelCallback
)
;
```
...
...
@@ -336,7 +336,7 @@ function cancelCallback(err) {
console
.
info
(
"
cancel success
"
);
}
}
Notification
.
cancel
(
0
,
cancelCallback
)
Notification
.
cancel
(
0
,
cancelCallback
)
;
```
...
...
@@ -374,7 +374,7 @@ function cancelAllCallback(err) {
console
.
info
(
"
cancelAll success
"
);
}
}
Notification
.
cancelAll
(
cancelAllCallback
)
Notification
.
cancelAll
(
cancelAllCallback
)
;
```
...
...
@@ -444,10 +444,10 @@ function addSlotCallBack(err) {
}
}
// 通知slot对象
var
notificationSlot
=
{
let
notificationSlot
=
{
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
Notification
.
addSlot
(
notificationSlot
,
addSlotCallBack
)
}
;
Notification
.
addSlot
(
notificationSlot
,
addSlotCallBack
)
;
```
...
...
@@ -482,9 +482,9 @@ addSlot(slot: NotificationSlot): Promise\<void\>
```
js
// 通知slot对象
var
notificationSlot
=
{
let
notificationSlot
=
{
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
}
;
Notification
.
addSlot
(
notificationSlot
).
then
(()
=>
{
console
.
info
(
"
addSlot success
"
);
});
...
...
@@ -526,7 +526,7 @@ function addSlotCallBack(err) {
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) {
}
}
// 通知slot对象
var
notificationSlot
=
{
let
notificationSlot
=
{
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
}
;
// 通知slot array 对象
var
notificationSlotArray
=
new
Array
();
let
notificationSlotArray
=
new
Array
();
notificationSlotArray
[
0
]
=
notificationSlot
;
Notification
.
addSlots
(
notificationSlotArray
,
addSlotsCallBack
)
Notification
.
addSlots
(
notificationSlotArray
,
addSlotsCallBack
)
;
```
...
...
@@ -644,11 +644,11 @@ addSlots(slots: Array\<NotificationSlot\>): Promise\<void\>
```
js
// 通知slot对象
var
notificationSlot
=
{
let
notificationSlot
=
{
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
}
;
// 通知slot array 对象
var
notificationSlotArray
=
new
Array
();
let
notificationSlotArray
=
new
Array
();
notificationSlotArray
[
0
]
=
notificationSlot
;
Notification
.
addSlots
(
notificationSlotArray
).
then
(()
=>
{
...
...
@@ -692,8 +692,8 @@ function getSlotCallback(err,data) {
console
.
info
(
"
getSlot success
"
);
}
}
var
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
Notification
.
getSlot
(
slotType
,
getSlotCallback
)
let
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
Notification
.
getSlot
(
slotType
,
getSlotCallback
)
;
```
...
...
@@ -729,7 +729,7 @@ getSlot(slotType: SlotType): Promise\<NotificationSlot\>
**示例:**
```
js
var
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
let
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
Notification
.
getSlot
(
slotType
).
then
((
data
)
=>
{
console
.
info
(
"
getSlot success, data:
"
+
JSON
.
stringify
(
data
));
});
...
...
@@ -770,7 +770,7 @@ function getSlotsCallback(err,data) {
console
.
info
(
"
getSlots success
"
);
}
}
Notification
.
getSlots
(
getSlotsCallback
)
Notification
.
getSlots
(
getSlotsCallback
)
;
```
...
...
@@ -841,8 +841,8 @@ function removeSlotCallback(err) {
console
.
info
(
"
removeSlot success
"
);
}
}
var
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
Notification
.
removeSlot
(
slotType
,
removeSlotCallback
)
let
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
Notification
.
removeSlot
(
slotType
,
removeSlotCallback
)
;
```
...
...
@@ -872,7 +872,7 @@ removeSlot(slotType: SlotType): Promise\<void\>
**示例:**
```
js
var
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
let
slotType
=
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
;
Notification
.
removeSlot
(
slotType
).
then
(()
=>
{
console
.
info
(
"
removeSlot success
"
);
});
...
...
@@ -912,7 +912,7 @@ function removeAllCallBack(err) {
console
.
info
(
"
removeAllSlots success
"
);
}
}
Notification
.
removeAllSlots
(
removeAllCallBack
)
Notification
.
removeAllSlots
(
removeAllCallBack
)
;
```
...
...
@@ -982,9 +982,9 @@ function setNotificationEnablenCallback(err) {
console
.
info
(
"
setNotificationEnablenCallback success
"
);
}
}
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
setNotificationEnable
(
bundle
,
false
,
setNotificationEnablenCallback
);
```
...
...
@@ -1021,9 +1021,9 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\<void\>
**示例:**
```
js
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
setNotificationEnable
(
bundle
,
false
).
then
(()
=>
{
console
.
info
(
"
setNotificationEnable success
"
);
});
...
...
@@ -1069,9 +1069,9 @@ function isNotificationEnabledCallback(err, data) {
console
.
info
(
"
isNotificationEnabled success
"
);
}
}
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
isNotificationEnabled
(
bundle
,
isNotificationEnabledCallback
);
```
...
...
@@ -1113,9 +1113,9 @@ isNotificationEnabled(bundle: BundleOption): Promise\<boolean\>
**示例:**
```
js
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
isNotificationEnabled
(
bundle
).
then
((
data
)
=>
{
console
.
info
(
"
isNotificationEnabled success, data:
"
+
JSON
.
stringify
(
data
));
});
...
...
@@ -1247,9 +1247,9 @@ function displayBadgeCallback(err) {
console
.
info
(
"
displayBadge success
"
);
}
}
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
displayBadge
(
bundle
,
false
,
displayBadgeCallback
);
```
...
...
@@ -1286,9 +1286,9 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\<void\>
**示例:**
```
js
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
displayBadge
(
bundle
,
false
).
then
(()
=>
{
console
.
info
(
"
displayBadge success
"
);
});
...
...
@@ -1334,9 +1334,9 @@ function isBadgeDisplayedCallback(err, data) {
console
.
info
(
"
isBadgeDisplayed success
"
);
}
}
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
isBadgeDisplayed
(
bundle
,
isBadgeDisplayedCallback
);
```
...
...
@@ -1378,9 +1378,9 @@ isBadgeDisplayed(bundle: BundleOption): Promise\<boolean\>
**示例:**
```
js
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
isBadgeDisplayed
(
bundle
).
then
((
data
)
=>
{
console
.
info
(
"
isBadgeDisplayed success, data:
"
+
JSON
.
stringify
(
data
));
});
...
...
@@ -1429,12 +1429,12 @@ function setSlotByBundleCallback(err) {
console
.
info
(
"
setSlotByBundle success
"
);
}
}
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
var
notificationSlot
=
{
}
;
let
notificationSlot
=
{
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
}
;
Notification
.
setSlotByBundle
(
bundle
,
notificationSlot
,
setSlotByBundleCallback
);
```
...
...
@@ -1471,12 +1471,12 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void\>
**示例:**
```
js
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
var
notificationSlot
=
{
}
;
let
notificationSlot
=
{
type
:
Notification
.
SlotType
.
SOCIAL_COMMUNICATION
}
}
;
Notification
.
setSlotByBundle
(
bundle
,
notificationSlot
).
then
(()
=>
{
console
.
info
(
"
setSlotByBundle success
"
);
});
...
...
@@ -1522,9 +1522,9 @@ function getSlotsByBundleCallback(err, data) {
console
.
info
(
"
getSlotsByBundle success
"
);
}
}
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
getSlotsByBundle
(
bundle
,
getSlotsByBundleCallback
);
```
...
...
@@ -1566,9 +1566,9 @@ getSlotsByBundle(bundle: BundleOption): Promise<Array\<NotificationSlot\>>
**示例:**
```
js
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
getSlotsByBundle
(
bundle
).
then
((
data
)
=>
{
console
.
info
(
"
getSlotsByBundle success, data:
"
+
JSON
.
stringify
(
data
));
});
...
...
@@ -1614,9 +1614,9 @@ function getSlotNumByBundleCallback(err, data) {
console
.
info
(
"
getSlotNumByBundle success
"
);
}
}
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
getSlotNumByBundle
(
bundle
,
getSlotNumByBundleCallback
);
```
...
...
@@ -1658,9 +1658,9 @@ getSlotNumByBundle(bundle: BundleOption): Promise\<number\>
**示例:**
```
js
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
getSlotNumByBundle
(
bundle
).
then
((
data
)
=>
{
console
.
info
(
"
getSlotNumByBundle success, data:
"
+
JSON
.
stringify
(
data
));
});
...
...
@@ -1921,7 +1921,7 @@ function cancelGroupCallback(err) {
}
}
var
groupName
=
"
GroupName
"
;
let
groupName
=
"
GroupName
"
;
Notification
.
cancelGroup
(
groupName
,
cancelGroupCallback
);
```
...
...
@@ -1953,7 +1953,7 @@ cancelGroup(groupName: string): Promise\<void\>
**示例:**
```
js
var
groupName
=
"
GroupName
"
;
let
groupName
=
"
GroupName
"
;
Notification
.
cancelGroup
(
groupName
).
then
(()
=>
{
console
.
info
(
"
cancelGroup success
"
);
});
...
...
@@ -2001,8 +2001,8 @@ function removeGroupByBundleCallback(err) {
}
}
var
bundleOption
=
{
bundle
:
"
Bundle
"
};
var
groupName
=
"
GroupName
"
;
let
bundleOption
=
{
bundle
:
"
Bundle
"
};
let
groupName
=
"
GroupName
"
;
Notification
.
removeGroupByBundle
(
bundleOption
,
groupName
,
removeGroupByBundleCallback
);
```
...
...
@@ -2040,8 +2040,8 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void\>
**示例:**
```
js
var
bundleOption
=
{
bundle
:
"
Bundle
"
};
var
groupName
=
"
GroupName
"
;
let
bundleOption
=
{
bundle
:
"
Bundle
"
};
let
groupName
=
"
GroupName
"
;
Notification
.
removeGroupByBundle
(
bundleOption
,
groupName
).
then
(()
=>
{
console
.
info
(
"
removeGroupByBundle success
"
);
});
...
...
@@ -2087,11 +2087,11 @@ function setDoNotDisturbDateCallback(err) {
}
}
var
doNotDisturbDate
=
{
let
doNotDisturbDate
=
{
type
:
Notification
.
DoNotDisturbType
.
TYPE_ONCE
,
begin
:
new
Date
(),
end
:
new
Date
(
2021
,
11
,
15
,
18
,
0
)
}
}
;
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
,
setDoNotDisturbDateCallback
);
```
...
...
@@ -2127,11 +2127,11 @@ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void\>
**示例:**
```
js
var
doNotDisturbDate
=
{
let
doNotDisturbDate
=
{
type
:
Notification
.
DoNotDisturbType
.
TYPE_ONCE
,
begin
:
new
Date
(),
end
:
new
Date
(
2021
,
11
,
15
,
18
,
0
)
}
}
;
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
).
then
(()
=>
{
console
.
info
(
"
setDoNotDisturbDate success
"
);
});
...
...
@@ -2178,13 +2178,13 @@ function setDoNotDisturbDateCallback(err) {
}
}
var
doNotDisturbDate
=
{
let
doNotDisturbDate
=
{
type
:
Notification
.
DoNotDisturbType
.
TYPE_ONCE
,
begin
:
new
Date
(),
end
:
new
Date
(
2021
,
11
,
15
,
18
,
0
)
}
}
;
var
userId
=
1
let
userId
=
1
;
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
,
userId
,
setDoNotDisturbDateCallback
);
```
...
...
@@ -2222,13 +2222,13 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void\>
**示例:**
```
js
var
doNotDisturbDate
=
{
let
doNotDisturbDate
=
{
type
:
Notification
.
DoNotDisturbType
.
TYPE_ONCE
,
begin
:
new
Date
(),
end
:
new
Date
(
2021
,
11
,
15
,
18
,
0
)
}
}
;
var
userId
=
1
let
userId
=
1
;
Notification
.
setDoNotDisturbDate
(
doNotDisturbDate
,
userId
).
then
(()
=>
{
console
.
info
(
"
setDoNotDisturbDate success
"
);
...
...
@@ -2352,7 +2352,7 @@ function getDoNotDisturbDateCallback(err,data) {
}
}
var
userId
=
1
let
userId
=
1
;
Notification
.
getDoNotDisturbDate
(
userId
,
getDoNotDisturbDateCallback
);
```
...
...
@@ -2395,7 +2395,7 @@ getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate\>
**示例:**
```
js
var
userId
=
1
let
userId
=
1
;
Notification
.
getDoNotDisturbDate
(
userId
).
then
((
data
)
=>
{
console
.
info
(
"
getDoNotDisturbDate success, data:
"
+
JSON
.
stringify
(
data
));
...
...
@@ -2508,7 +2508,7 @@ isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean\>): voi
**示例:**
```
javascript
var
templateName
=
'
process
'
;
let
templateName
=
'
process
'
;
function
isSupportTemplateCallback
(
err
,
data
)
{
if
(
err
)
{
console
.
info
(
"
isSupportTemplate failed
"
+
JSON
.
stringify
(
err
));
...
...
@@ -2554,7 +2554,7 @@ isSupportTemplate(templateName: string): Promise\<boolean\>
**示例:**
```
javascript
var
templateName
=
'
process
'
;
let
templateName
=
'
process
'
;
Notification
.
isSupportTemplate
(
templateName
).
then
((
data
)
=>
{
console
.
info
(
"
isSupportTemplate success, data:
"
+
JSON
.
stringify
(
data
));
...
...
@@ -2666,7 +2666,7 @@ function setDistributedEnableCallback() {
}
};
var
enable
=
true
let
enable
=
true
;
Notification
.
setDistributedEnable
(
enable
,
setDistributedEnableCallback
);
```
...
...
@@ -2703,7 +2703,7 @@ setDistributedEnable(enable: boolean): Promise\<void>
**示例:**
```
javascript
var
enable
=
true
let
enable
=
true
;
Notification
.
setDistributedEnable
(
enable
).
then
(()
=>
{
console
.
info
(
"
setDistributedEnable success
"
);
...
...
@@ -2824,11 +2824,11 @@ function setDistributedEnableByBundleCallback(err) {
}
};
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
var
enable
=
true
let
enable
=
true
Notification
.
setDistributedEnableByBundle
(
bundle
,
enable
,
setDistributedEnableByBundleCallback
);
```
...
...
@@ -2867,11 +2867,11 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\<vo
**示例:**
```
javascript
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
var
enable
=
true
let
enable
=
true
Notification
.
setDistributedEnableByBundle
(
bundle
,
enable
).
then
(()
=>
{
console
.
info
(
"
setDistributedEnableByBundle success
"
);
...
...
@@ -2918,9 +2918,9 @@ function isDistributedEnabledByBundleCallback(data) {
}
};
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
isDistributedEnabledByBundle
(
bundle
,
isDistributedEnabledByBundleCallback
);
```
...
...
@@ -2964,9 +2964,9 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>
**示例:**
```
javascript
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
Notification
.
isDistributedEnabledByBundle
(
bundle
).
then
((
data
)
=>
{
console
.
info
(
"
isDistributedEnabledByBundle success, data:
"
+
JSON
.
stringify
(
data
));
...
...
@@ -3096,9 +3096,9 @@ function callback(err) {
}
}
// 被代理应用的包名
let
representativeBundle
=
"
com.example.demo
"
let
representativeBundle
=
"
com.example.demo
"
;
// 用户ID
let
userId
=
100
let
userId
=
100
;
// NotificationRequest对象
let
request
=
{
id
:
1
,
...
...
@@ -3110,7 +3110,7 @@ let request = {
additionalText
:
"
test_additionalText
"
}
}
}
}
;
Notification
.
publishAsBundle
(
request
,
representativeBundle
,
userId
,
callback
);
```
...
...
@@ -3152,11 +3152,11 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
```
js
// 被代理应用的包名
let
representativeBundle
=
"
com.example.demo
"
let
representativeBundle
=
"
com.example.demo
"
;
// 用户ID
let
userId
=
100
let
userId
=
100
;
// NotificationRequest对象
var
request
=
{
let
request
=
{
id
:
1
,
content
:
{
contentType
:
Notification
.
ContentType
.
NOTIFICATION_CONTENT_BASIC_TEXT
,
...
...
@@ -3166,7 +3166,7 @@ var request = {
additionalText
:
"
test_additionalText
"
}
}
}
}
;
Notification
.
publishAsBundle
(
request
,
representativeBundle
,
userId
).
then
(()
=>
{
console
.
info
(
"
publishAsBundle success
"
);
...
...
@@ -3218,9 +3218,9 @@ function cancelAsBundleCallback(err) {
}
}
// 被代理应用的包名
let
representativeBundle
=
"
com.example.demo
"
let
representativeBundle
=
"
com.example.demo
"
;
// 用户ID
let
userId
=
100
let
userId
=
100
;
Notification
.
cancelAsBundle
(
0
,
representativeBundle
,
userId
,
cancelAsBundleCallback
);
```
...
...
@@ -3261,9 +3261,9 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis
```
js
// 被代理应用的包名
let
representativeBundle
=
"
com.example.demo
"
let
representativeBundle
=
"
com.example.demo
"
;
// 用户ID
let
userId
=
100
let
userId
=
100
;
Notification
.
cancelAsBundle
(
0
,
representativeBundle
,
userId
).
then
(()
=>
{
console
.
info
(
"
cancelAsBundle success
"
);
...
...
zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md
浏览文件 @
97aba69a
...
...
@@ -56,12 +56,12 @@ function subscribeCallback(err) {
function
onConsumeCallback
(
data
)
{
console
.
info
(
"
Consume callback:
"
+
JSON
.
stringify
(
data
));
}
var
subscriber
=
{
let
subscriber
=
{
onConsume
:
onConsumeCallback
}
var
info
=
{
}
;
let
info
=
{
bundleNames
:
[
"
bundleName1
"
,
"
bundleName2
"
]
}
}
;
NotificationSubscribe
.
subscribe
(
subscriber
,
info
,
subscribeCallback
);
```
...
...
@@ -107,9 +107,9 @@ function subscribeCallback(err) {
function
onConsumeCallback
(
data
)
{
console
.
info
(
"
Consume callback:
"
+
JSON
.
stringify
(
data
));
}
var
subscriber
=
{
let
subscriber
=
{
onConsume
:
onConsumeCallback
}
}
;
NotificationSubscribe
.
subscribe
(
subscriber
,
subscribeCallback
);
```
...
...
@@ -148,7 +148,7 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo):
function
onConsumeCallback
(
data
)
{
console
.
info
(
"
Consume callback:
"
+
JSON
.
stringify
(
data
));
}
var
subscriber
=
{
let
subscriber
=
{
onConsume
:
onConsumeCallback
};
NotificationSubscribe
.
subscribe
(
subscriber
).
then
(()
=>
{
...
...
@@ -198,9 +198,9 @@ function unsubscribeCallback(err) {
function
onDisconnectCallback
(
data
)
{
console
.
info
(
"
Cancel callback:
"
+
JSON
.
stringify
(
data
));
}
var
subscriber
=
{
let
subscriber
=
{
onDisconnect
:
onDisconnectCallback
}
}
;
NotificationSubscribe
.
unsubscribe
(
subscriber
,
unsubscribeCallback
);
```
...
...
@@ -238,7 +238,7 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\<void\>
function
onDisconnectCallback
(
data
)
{
console
.
info
(
"
Cancel callback:
"
+
JSON
.
stringify
(
data
));
}
var
subscriber
=
{
let
subscriber
=
{
onDisconnect
:
onDisconnectCallback
};
NotificationSubscribe
.
unsubscribe
(
subscriber
).
then
(()
=>
{
...
...
@@ -289,14 +289,14 @@ function removeCallback(err) {
console
.
info
(
"
remove success
"
);
}
}
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
var
notificationKey
=
{
}
;
let
notificationKey
=
{
id
:
0
,
label
:
"
label
"
,
}
var
reason
=
NotificationSubscribe
.
RemoveReason
.
CLICK_REASON_REMOVE
;
}
;
let
reason
=
NotificationSubscribe
.
RemoveReason
.
CLICK_REASON_REMOVE
;
NotificationSubscribe
.
remove
(
bundle
,
notificationKey
,
reason
,
removeCallback
);
```
...
...
@@ -335,14 +335,14 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea
**示例:**
```
js
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
var
notificationKey
=
{
}
;
let
notificationKey
=
{
id
:
0
,
label
:
"
label
"
,
}
var
reason
=
NotificationSubscribe
.
RemoveReason
.
CLICK_REASON_REMOVE
;
}
;
let
reason
=
NotificationSubscribe
.
RemoveReason
.
CLICK_REASON_REMOVE
;
NotificationSubscribe
.
remove
(
bundle
,
notificationKey
,
reason
).
then
(()
=>
{
console
.
info
(
"
remove success
"
);
});
...
...
@@ -382,7 +382,7 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void\>):
**示例:**
```
js
var
hashCode
=
'
hashCode
'
let
hashCode
=
'
hashCode
'
;
function
removeCallback
(
err
)
{
if
(
err
)
{
...
...
@@ -391,7 +391,7 @@ function removeCallback(err) {
console
.
info
(
"
remove success
"
);
}
}
var
reason
=
NotificationSubscribe
.
RemoveReason
.
CANCEL_REASON_REMOVE
;
let
reason
=
NotificationSubscribe
.
RemoveReason
.
CANCEL_REASON_REMOVE
;
NotificationSubscribe
.
remove
(
hashCode
,
reason
,
removeCallback
);
```
...
...
@@ -428,8 +428,8 @@ remove(hashCode: string, reason: RemoveReason): Promise\<void\>
**示例:**
```
js
var
hashCode
=
'
hashCode
'
var
reason
=
NotificationSubscribe
.
RemoveReason
.
CLICK_REASON_REMOVE
;
let
hashCode
=
'
hashCode
'
;
let
reason
=
NotificationSubscribe
.
RemoveReason
.
CLICK_REASON_REMOVE
;
NotificationSubscribe
.
remove
(
hashCode
,
reason
).
then
(()
=>
{
console
.
info
(
"
remove success
"
);
});
...
...
@@ -475,9 +475,9 @@ function removeAllCallback(err) {
console
.
info
(
"
removeAll success
"
);
}
}
var
bundle
=
{
let
bundle
=
{
bundle
:
"
bundleName1
"
,
}
}
;
NotificationSubscribe
.
removeAll
(
bundle
,
removeAllCallback
);
```
...
...
@@ -600,7 +600,7 @@ function removeAllCallback(err) {
}
}
var
userId
=
1
let
userId
=
1
;
NotificationSubscribe
.
removeAll
(
userId
,
removeAllCallback
);
```
...
...
@@ -643,7 +643,7 @@ function removeAllCallback(err) {
}
}
var
userId
=
1
let
userId
=
1
;
NotificationSubscribe
.
removeAll
(
userId
,
removeAllCallback
);
```
...
...
@@ -689,7 +689,7 @@ function onConsumeCallback(data) {
console
.
info
(
'
===> onConsume callback req.id:
'
+
req
.
id
);
};
var
subscriber
=
{
let
subscriber
=
{
onConsume
:
onConsumeCallback
};
...
...
@@ -729,7 +729,7 @@ function onCancelCallback(data) {
console
.
info
(
'
===> onCancel callback req.id:
'
+
req
.
id
);
}
var
subscriber
=
{
let
subscriber
=
{
onCancel
:
onCancelCallback
};
...
...
@@ -767,7 +767,7 @@ function onUpdateCallback(map) {
console
.
info
(
'
===> onUpdateCallback map:
'
+
JSON
.
stringify
(
map
));
}
var
subscriber
=
{
let
subscriber
=
{
onUpdate
:
onUpdateCallback
};
...
...
@@ -799,7 +799,7 @@ function onConnectCallback() {
console
.
info
(
'
===> onConnect in test
'
);
}
var
subscriber
=
{
let
subscriber
=
{
onConnect
:
onConnectCallback
};
...
...
@@ -841,7 +841,7 @@ function onDisconnectCallback() {
console
.
info
(
'
===> onDisconnect in test
'
);
}
var
subscriber
=
{
let
subscriber
=
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
};
...
...
@@ -877,7 +877,7 @@ function onDestroyCallback() {
console
.
info
(
'
===> onDestroy in test
'
);
}
var
subscriber
=
{
let
subscriber
=
{
onDestroy
:
onDestroyCallback
};
...
...
@@ -915,7 +915,7 @@ function onDoNotDisturbDateChangeCallback(mode) {
console
.
info
(
'
===> onDoNotDisturbDateChange:
'
+
mode
);
}
var
subscriber
=
{
let
subscriber
=
{
onDoNotDisturbDateChange
:
onDoNotDisturbDateChangeCallback
};
...
...
@@ -956,7 +956,7 @@ function onEnabledNotificationChangedCallback(callbackData) {
console
.
info
(
"
enable:
"
,
callbackData
.
enable
);
};
var
subscriber
=
{
let
subscriber
=
{
onEnabledNotificationChanged
:
onEnabledNotificationChangedCallback
};
...
...
zh-cn/application-dev/reference/apis/js-apis-system-notification.md
浏览文件 @
97aba69a
...
...
@@ -59,9 +59,9 @@ export default {
clickAction
:
{
bundleName
:
'
com.example.testapp
'
,
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录