Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
2bfb0cc3
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2bfb0cc3
编写于
2月 27, 2023
作者:
M
mingxihua
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mingxihua@huawei.com.cn
Signed-off-by:
N
mingxihua
<
mingxihua@huawei.com
>
上级
7e9154af
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
281 addition
and
284 deletion
+281
-284
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md
...-dev/reference/apis/js-apis-app-ability-abilityManager.md
+5
-5
zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md
...tion-dev/reference/apis/js-apis-app-ability-appManager.md
+13
-13
zh-cn/application-dev/reference/apis/js-apis-app-ability-configuration.md
...n-dev/reference/apis/js-apis-app-ability-configuration.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-app-ability-configurationConstant.md
...ference/apis/js-apis-app-ability-configurationConstant.md
+7
-7
zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md
...reference/apis/js-apis-app-ability-environmentCallback.md
+4
-4
zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md
...on-dev/reference/apis/js-apis-app-ability-errorManager.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md
...-dev/reference/apis/js-apis-app-ability-missionManager.md
+15
-15
zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md
...dev/reference/apis/js-apis-app-ability-quickFixManager.md
+5
-5
zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md
...pplication-dev/reference/apis/js-apis-app-ability-want.md
+4
-4
zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md
...ation-dev/reference/apis/js-apis-app-ability-wantAgent.md
+34
-34
zh-cn/application-dev/reference/apis/js-apis-application-configuration.md
...n-dev/reference/apis/js-apis-application-configuration.md
+4
-7
zh-cn/application-dev/reference/apis/js-apis-application-formHost.md
...cation-dev/reference/apis/js-apis-application-formHost.md
+32
-32
zh-cn/application-dev/reference/apis/js-apis-application-formProvider.md
...on-dev/reference/apis/js-apis-application-formProvider.md
+9
-9
zh-cn/application-dev/reference/apis/js-apis-application-want.md
...pplication-dev/reference/apis/js-apis-application-want.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-application-windowExtensionAbility.md
...erence/apis/js-apis-application-windowExtensionAbility.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md
...erence/apis/js-apis-inner-application-abilityDelegator.md
+69
-69
zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md
...ce/apis/js-apis-inner-application-formExtensionContext.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-inner-application-processData.md
...v/reference/apis/js-apis-inner-application-processData.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md
...erence/apis/js-apis-inner-application-uiAbilityContext.md
+67
-67
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md
浏览文件 @
2bfb0cc3
...
...
@@ -63,7 +63,7 @@ const config = {
language
:
'
Zh-Hans
'
,
// 简体中文
colorMode
:
COLOR_MODE_LIGHT
,
// 浅色模式
direction
:
DIRECTION_VERTICAL
,
// 垂直方向
screenDensity
:
SCREEN_DENSITY_SDPI
,
// 屏幕
分辨率
为'sdpi'
screenDensity
:
SCREEN_DENSITY_SDPI
,
// 屏幕
像素密度
为'sdpi'
displayId
:
1
,
// 应用在Id为1的物理屏上显示
hasPointerDevice
:
true
,
// 指针类型设备已连接
};
...
...
@@ -121,7 +121,7 @@ const config = {
language
:
'
Zh-Hans
'
,
// 简体中文
colorMode
:
COLOR_MODE_LIGHT
,
// 浅色模式
direction
:
DIRECTION_VERTICAL
,
// 垂直方向
screenDensity
:
SCREEN_DENSITY_SDPI
,
// 屏幕
分辨率
为'sdpi'
screenDensity
:
SCREEN_DENSITY_SDPI
,
// 屏幕
像素密度
为'sdpi'
displayId
:
1
,
// 应用在Id为1的物理屏上显示
hasPointerDevice
:
true
,
// 指针类型设备已连接
};
...
...
@@ -131,7 +131,7 @@ try {
console
.
log
(
'
updateConfiguration success.
'
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
updateConfiguration fail, err:
'
+
JSON
.
stringify
(
err
));
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
...
...
@@ -310,7 +310,7 @@ try {
console
.
log
(
'
getExtensionRunningInfos success, data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
log
(
'
getExtensionRunningInfos fail, err:
'
+
JSON
.
stringify
(
err
));
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
...
...
@@ -384,5 +384,5 @@ abilityManager.getTopAbility().then((data) => {
console
.
log
(
'
getTopAbility success, data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
log
(
'
getTopAbility fail, err:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md
浏览文件 @
2bfb0cc3
...
...
@@ -45,7 +45,7 @@ appManager.isRunningInStabilityTest((err, flag) => {
}
else
{
console
.
log
(
'
The result of isRunningInStabilityTest is:
'
+
JSON
.
stringify
(
flag
));
}
})
})
;
```
...
...
@@ -151,7 +151,7 @@ appManager.isRamConstrainedDevice((err, data) => {
}
else
{
console
.
log
(
'
The result of isRamConstrainedDevice is:
'
+
JSON
.
stringify
(
data
));
}
})
})
;
```
## appManager.getAppMemorySize
...
...
@@ -221,7 +221,7 @@ appManager.getAppMemorySize((err, data) => {
}
else
{
console
.
log
(
'
The size of app memory is:
'
+
JSON
.
stringify
(
data
));
}
})
})
;
```
## appManager.getProcessRunningInformation
...
...
@@ -299,7 +299,7 @@ appManager.getProcessRunningInformation((err, data) => {
}
else
{
console
.
log
(
'
The process running information is:
'
+
JSON
.
stringify
(
data
));
}
})
})
;
```
## appManager.on
...
...
@@ -356,7 +356,7 @@ let applicationStateObserver = {
onProcessStateChanged
(
processData
)
{
console
.
log
(
`[appManager] onProcessStateChanged:
${
JSON
.
stringify
(
processData
)}
`
);
}
}
}
;
try
{
const
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
);
console
.
log
(
`[appManager] observerCode:
${
observerId
}
`
);
...
...
@@ -420,7 +420,7 @@ let applicationStateObserver = {
onProcessStateChanged
(
processData
)
{
console
.
log
(
`[appManager] onProcessStateChanged:
${
JSON
.
stringify
(
processData
)}
`
);
}
}
}
;
let
bundleNameList
=
[
'
bundleName1
'
,
'
bundleName2
'
];
try
{
const
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
,
bundleNameList
);
...
...
@@ -482,7 +482,7 @@ let applicationStateObserver = {
onProcessStateChanged
(
processData
)
{
console
.
log
(
`[appManager] onProcessStateChanged:
${
JSON
.
stringify
(
processData
)}
`
);
}
}
}
;
let
bundleNameList
=
[
'
bundleName1
'
,
'
bundleName2
'
];
try
{
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
,
bundleNameList
);
...
...
@@ -563,7 +563,7 @@ let applicationStateObserver = {
onProcessStateChanged
(
processData
)
{
console
.
log
(
`[appManager] onProcessStateChanged:
${
JSON
.
stringify
(
processData
)}
`
);
}
}
}
;
let
bundleNameList
=
[
'
bundleName1
'
,
'
bundleName2
'
];
try
{
observerId
=
appManager
.
on
(
'
applicationState
'
,
applicationStateObserver
,
bundleNameList
);
...
...
@@ -578,7 +578,7 @@ try {
console
.
log
(
'
unregisterApplicationStateObserver success, data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
log
(
'
unregisterApplicationStateObserver faile, err:
'
+
JSON
.
stringify
(
err
));
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
@@ -664,7 +664,7 @@ appManager.getForegroundApplications().then((data) => {
console
.
log
(
'
getForegroundApplications success, data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
log
(
'
getForegroundApplications fail, err:
'
+
JSON
.
stringify
(
err
));
})
})
;
```
## appManager.killProcessWithAccount
...
...
@@ -706,7 +706,7 @@ try {
console
.
log
(
'
killProcessWithAccount success
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
killProcessWithAccount fail, err:
'
+
JSON
.
stringify
(
err
));
})
})
;
}
catch
(
paramError
)
{
console
.
error
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
@@ -848,7 +848,7 @@ try {
console
.
log
(
'
killProcessesByBundleName success.
'
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
killProcessesByBundleName fail, err:
'
+
JSON
.
stringify
(
err
));
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
@@ -944,7 +944,7 @@ try {
console
.
log
(
'
clearUpApplicationData success.
'
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
clearUpApplicationData fail, err:
'
+
JSON
.
stringify
(
err
));
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-configuration.md
浏览文件 @
2bfb0cc3
...
...
@@ -13,7 +13,7 @@
| language | string | 是 | 是 | 表示应用程序的当前语言。例如:zh。 |
| colorMode |
[
ColorMode
](
js-apis-app-ability-configurationConstant.md#configurationconstantcolormode
)
| 是 | 是 | 表示深浅色模式,取值范围:未设置(COLOR_MODE_NOT_SET),浅色模式(COLOR_MODE_LIGHT),深色模式(COLOR_MODE_DARK)。默认为浅色。 |
| direction |
[
Direction
](
js-apis-app-ability-configurationConstant.md#configurationconstantdirection
)
| 是 | 否 | 表示屏幕方向,取值范围:未设置(DIRECTION_NOT_SET),水平方向(DIRECTION_HORIZONTAL),垂直方向(DIRECTION_VERTICAL)。 |
| screenDensity |
[
ScreenDensity
](
js-apis-app-ability-configurationConstant.md#configurationconstantscreendensity
)
| 是 | 否 | 表示屏幕
分辨率
,取值范围:未设置(SCREEN_DENSITY_NOT_SET),SCREEN_DENSITY_SDPI(120)、SCREEN_DENSITY_MDPI(160)、SCREEN_DENSITY_LDPI(240)、SCREEN_DENSITY_XLDPI(320)、SCREEN_DENSITY_XXLDPI(480)、SCREEN_DENSITY_XXXLDPI(640)。 |
| screenDensity |
[
ScreenDensity
](
js-apis-app-ability-configurationConstant.md#configurationconstantscreendensity
)
| 是 | 否 | 表示屏幕
像素密度
,取值范围:未设置(SCREEN_DENSITY_NOT_SET),SCREEN_DENSITY_SDPI(120)、SCREEN_DENSITY_MDPI(160)、SCREEN_DENSITY_LDPI(240)、SCREEN_DENSITY_XLDPI(320)、SCREEN_DENSITY_XXLDPI(480)、SCREEN_DENSITY_XXXLDPI(640)。 |
| displayId | number | 是 | 否 | 表示应用所在的物理屏幕Id。 |
| hasPointerDevice | boolean | 是 | 否 | 指示指针类型设备是否已连接,如键鼠、触控板等。 |
...
...
@@ -28,7 +28,7 @@
onCreate
(
want
,
launchParam
)
{
let
envCallback
=
{
onConfigurationUpdated
(
config
)
{
console
.
info
(
`envCallback onConfigurationUpdated success:
${
JSON
.
stringify
(
config
)}
`
)
console
.
info
(
`envCallback onConfigurationUpdated success:
${
JSON
.
stringify
(
config
)}
`
)
;
let
language
=
config
.
language
;
let
colorMode
=
config
.
colorMode
;
let
direction
=
config
.
direction
;
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-configurationConstant.md
浏览文件 @
2bfb0cc3
...
...
@@ -46,10 +46,10 @@ import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant';
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| SCREEN_DENSITY_NOT_SET | 0 | 未设置屏幕
分辨率
。 |
| SCREEN_DENSITY_SDPI | 120 | 屏幕
分辨率
为'sdpi'。 |
| SCREEN_DENSITY_MDPI | 160 | 屏幕
分辨率
为'mdpi'。 |
| SCREEN_DENSITY_LDPI | 240 | 屏幕
分辨率
为'ldpi'。 |
| SCREEN_DENSITY_XLDPI | 320 | 屏幕
分辨率
为'xldpi'。 |
| SCREEN_DENSITY_XXLDPI | 480 | 屏幕
分辨率
为'xxldpi'。 |
| SCREEN_DENSITY_XXXLDPI | 640 | 屏幕
分辨率
为'xxxldpi'。 |
| SCREEN_DENSITY_NOT_SET | 0 | 未设置屏幕
像素密度
。 |
| SCREEN_DENSITY_SDPI | 120 | 屏幕
像素密度
为'sdpi'。 |
| SCREEN_DENSITY_MDPI | 160 | 屏幕
像素密度
为'mdpi'。 |
| SCREEN_DENSITY_LDPI | 240 | 屏幕
像素密度
为'ldpi'。 |
| SCREEN_DENSITY_XLDPI | 320 | 屏幕
像素密度
为'xldpi'。 |
| SCREEN_DENSITY_XXLDPI | 480 | 屏幕
像素密度
为'xxldpi'。 |
| SCREEN_DENSITY_XXXLDPI | 640 | 屏幕
像素密度
为'xxxldpi'。 |
zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md
浏览文件 @
2bfb0cc3
...
...
@@ -53,20 +53,20 @@ let callbackId;
export
default
class
MyAbility
extends
Ability
{
onCreate
()
{
console
.
log
(
'
MyAbility onCreate
'
)
console
.
log
(
'
MyAbility onCreate
'
)
;
globalThis
.
applicationContext
=
this
.
context
.
getApplicationContext
();
let
E
nvironmentCallback
=
{
let
e
nvironmentCallback
=
{
onConfigurationUpdated
(
config
){
console
.
log
(
'
onConfigurationUpdated config:
'
+
JSON
.
stringify
(
config
));
},
onMemoryLevel
(
level
){
console
.
log
(
'
onMemoryLevel level: ${JSON.stringify(level)}
'
);
}
}
}
;
// 1.获取applicationContext
let
applicationContext
=
globalThis
.
applicationContext
;
// 2.通过applicationContext注册监听应用内生命周期
callbackId
=
applicationContext
.
registerEnvironmentCallback
(
E
nvironmentCallback
);
callbackId
=
applicationContext
.
registerEnvironmentCallback
(
e
nvironmentCallback
);
console
.
log
(
'
registerEnvironmentCallback number:
'
+
JSON
.
stringify
(
callbackId
));
}
onDestroy
()
{
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md
浏览文件 @
2bfb0cc3
...
...
@@ -31,9 +31,9 @@ on(type: 'error', observer: ErrorObserver): number;
```
js
let
observer
=
{
onUnhandledException
(
errorMsg
)
{
console
.
log
(
'
onUnhandledException, errorMsg:
'
,
errorMsg
)
console
.
log
(
'
onUnhandledException, errorMsg:
'
,
errorMsg
)
;
}
}
}
;
try
{
errorManager
.
on
(
'
error
'
,
observer
);
}
catch
(
paramError
)
{
...
...
@@ -106,7 +106,7 @@ try {
})
.
catch
((
err
)
=>
{
console
.
log
(
'
----------- unregisterErrorObserver fail ----------
'
,
err
);
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md
浏览文件 @
2bfb0cc3
...
...
@@ -9,7 +9,7 @@ missionManager模块提供系统任务管理能力,包括对系统任务执行
## 导入模块
```
ts
import
missionManager
from
'
@ohos.app.ability.missionManager
'
import
missionManager
from
'
@ohos.app.ability.missionManager
'
;
```
## 权限列表
...
...
@@ -51,7 +51,7 @@ on(type:'mission', listener: MissionListener): number;
onMissionIconUpdated
:
function
(
mission
,
icon
)
{
console
.
log
(
'
--------onMissionIconUpdated-------
'
);},
onMissionClosed
:
function
(
mission
)
{
console
.
log
(
'
--------onMissionClosed-------
'
);}
};
console
.
log
(
'
registerMissionListener
'
)
console
.
log
(
'
registerMissionListener
'
)
;
try
{
let
listenerid
=
missionManager
.
on
(
'
mission
'
,
listener
);
}
catch
(
paramError
)
{
...
...
@@ -90,13 +90,13 @@ off(type: 'mission', listenerId: number, callback: AsyncCallback<void>): v
onMissionIconUpdated
:
function
(
mission
,
icon
)
{
console
.
log
(
'
--------onMissionIconUpdated-------
'
);},
onMissionClosed
:
function
(
mission
)
{
console
.
log
(
'
--------onMissionClosed-------
'
);}
};
console
.
log
(
'
registerMissionListener
'
)
console
.
log
(
'
registerMissionListener
'
)
;
try
{
let
listenerid
=
missionManager
.
registerMissionListener
(
listener
);
missionManager
.
unregisterMissionListener
(
listenerid
,
(
error
)
=>
{
console
.
log
(
'
unregisterMissionListener
'
);
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
@@ -138,7 +138,7 @@ off(type: 'mission', listenerId: number): Promise<void>;
onMissionIconUpdated
:
function
(
mission
,
icon
)
{
console
.
log
(
'
--------onMissionIconUpdated-------
'
);},
onMissionClosed
:
function
(
mission
)
{
console
.
log
(
'
--------onMissionClosed-------
'
);}
};
console
.
log
(
'
registerMissionListener
'
)
console
.
log
(
'
registerMissionListener
'
)
;
try
{
let
listenerid
=
missionManager
.
registerMissionListener
(
listener
);
...
...
@@ -174,7 +174,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M
**示例:**
```
ts
import
missionManager
from
'
@ohos.app.ability.missionManager
'
import
missionManager
from
'
@ohos.app.ability.missionManager
'
;
try
{
let
allMissions
=
missionManager
.
getMissionInfos
(
''
,
10
).
catch
(
function
(
err
){
console
.
log
(
err
);});
...
...
@@ -221,7 +221,7 @@ getMissionInfo(deviceId: string, missionId: number): Promise<MissionInfo>;
**示例:**
```
ts
import
missionManager
from
'
@ohos.app.ability.missionManager
'
import
missionManager
from
'
@ohos.app.ability.missionManager
'
;
try
{
let
mission
=
missionManager
.
getMissionInfo
(
''
,
10
).
catch
(
function
(
err
){
...
...
@@ -256,14 +256,14 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr
**示例:**
```
ts
import
missionManager
from
'
@ohos.app.ability.missionManager
'
import
missionManager
from
'
@ohos.app.ability.missionManager
'
;
try
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
console
.
log
(
'
getMissionInfos is called, error.code =
'
+
error
.
code
);
console
.
log
(
'
size =
'
+
missions
.
length
);
console
.
log
(
'
missions =
'
+
JSON
.
stringify
(
missions
));
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
@@ -298,7 +298,7 @@ getMissionInfos(deviceId: string, numMax: number): Promise<Array<MissionIn
**示例:**
```
ts
import
missionManager
from
'
@ohos.app.ability.missionManager
'
import
missionManager
from
'
@ohos.app.ability.missionManager
'
;
try
{
let
allMissions
=
missionManager
.
getMissionInfos
(
''
,
10
).
catch
(
function
(
err
){
...
...
@@ -333,7 +333,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback&
**示例:**
```
ts
import
missionManager
from
'
@ohos.app.ability.missionManager
'
import
missionManager
from
'
@ohos.app.ability.missionManager
'
;
try
{
missionManager
.
getMissionInfos
(
''
,
10
,
(
error
,
missions
)
=>
{
...
...
@@ -345,8 +345,8 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback&
missionManager
.
getMissionSnapShot
(
''
,
id
,
(
error
,
snapshot
)
=>
{
console
.
log
(
'
getMissionSnapShot is called, error.code =
'
+
error
.
code
);
console
.
log
(
'
bundleName =
'
+
snapshot
.
ability
.
bundleName
);
})
})
})
;
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
@@ -435,8 +435,8 @@ getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: A
missionManager
.
getLowResolutionMissionSnapShot
(
''
,
id
,
(
error
,
snapshot
)
=>
{
console
.
log
(
'
getLowResolutionMissionSnapShot is called, error.code =
'
+
error
.
code
);
console
.
log
(
'
bundleName =
'
+
snapshot
.
ability
.
bundleName
);
})
})
})
;
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md
浏览文件 @
2bfb0cc3
...
...
@@ -77,7 +77,7 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>, callback: AsyncCallback\<v
}
else
{
console
.
info
(
'
applyQuickFix success
'
);
}
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
@@ -118,7 +118,7 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>): Promise\<void>;
console
.
info
(
'
applyQuickFix success
'
);
}).
catch
((
error
)
=>
{
console
.
info
(
`applyQuickFix err: +
${
error
}
`
);
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
@@ -149,14 +149,14 @@ getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\<Applicat
import
quickFixManager
from
'
@ohos.app.ability.quickFixManager
'
;
try
{
let
bundleName
=
'
bundleName
'
let
bundleName
=
'
bundleName
'
;
quickFixManager
.
getApplicationQuickFixInfo
(
bundleName
,
(
error
,
data
)
=>
{
if
(
error
)
{
console
.
info
(
`getApplicationQuickFixInfo error: +
${
error
}
`
);
}
else
{
console
.
info
(
`getApplicationQuickFixInfo success: +
${
data
}
`
);
}
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
@@ -197,7 +197,7 @@ getApplicationQuickFixInfo(bundleName: string): Promise\<ApplicationQuickFixInfo
console
.
info
(
`getApplicationQuickFixInfo success: +
${
data
}
`
);
}).
catch
((
error
)
=>
{
console
.
info
(
`getApplicationQuickFixInfo err: +
${
error
}
`
);
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md
浏览文件 @
2bfb0cc3
...
...
@@ -34,7 +34,7 @@ import Want from '@ohos.app.ability.Want';
-
基础用法
```
ts
var
want
=
{
let
want
=
{
'
deviceId
'
:
''
,
// deviceId为空表示本设备
'
bundleName
'
:
'
com.extreme.test
'
,
'
abilityName
'
:
'
MainAbility
'
,
...
...
@@ -43,7 +43,7 @@ import Want from '@ohos.app.ability.Want';
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console
.
log
(
'
error.code =
'
+
error
.
code
);
})
})
;
```
-
通过自定字段传递数据, 以下为当前支持类型。
...
...
@@ -110,13 +110,13 @@ import Want from '@ohos.app.ability.Want';
* 文件描述符(FD)
```ts
import fileio from '@ohos.fileio';
var
fd;
let
fd;
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
} catch(e) {
console.log('openSync fail:' + JSON.stringify(e));
}
var
want = {
let
want = {
'deviceId': '', // deviceId为空表示本设备
'bundleName': 'com.extreme.test',
'abilityName': 'MainAbility',
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md
浏览文件 @
2bfb0cc3
...
...
@@ -37,7 +37,7 @@ function getWantAgentCallback(err, data) {
console
.
info
(
'
==========================>getWantAgentCallback=======================>
'
);
}
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -62,7 +62,7 @@ var wantAgentInfo = {
operationType
:
WantAgent
.
OperationType
.
START_ABILITIES
,
requestCode
:
0
,
wantAgentFlags
:[
WantAgent
.
WantAgentFlags
.
UPDATE_PRESENT_FLAG
]
}
}
;
try
{
WantAgent
.
getWantAgent
(
wantAgentInfo
,
getWantAgentCallback
);
...
...
@@ -100,7 +100,7 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -160,7 +160,7 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//getWantAgent回调
function
getWantAgentCallback
(
err
,
data
)
{
...
...
@@ -172,7 +172,7 @@ function getWantAgentCallback(err, data) {
}
}
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -241,10 +241,10 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -309,7 +309,7 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//getWantAgent回调
function
getWantAgentCallback
(
err
,
data
)
{
...
...
@@ -321,7 +321,7 @@ function getWantAgentCallback(err, data) {
}
}
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -390,10 +390,10 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -460,7 +460,7 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//getWantAgent回调
function
getWantAgentCallback
(
err
,
data
)
{
...
...
@@ -472,7 +472,7 @@ function getWantAgentCallback(err, data) {
}
}
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -543,10 +543,10 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -611,7 +611,7 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//getWantAgent回调
function
getWantAgentCallback
(
err
,
data
)
{
...
...
@@ -623,7 +623,7 @@ function getWantAgentCallback(err, data) {
}
}
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -692,10 +692,10 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -761,7 +761,7 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//getWantAgent回调
function
getWantAgentCallback
(
err
,
data
)
{
...
...
@@ -773,7 +773,7 @@ function getWantAgentCallback(err, data) {
}
}
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -809,7 +809,7 @@ try {
}
var
triggerInfo
=
{
let
triggerInfo
=
{
code
:
0
};
WantAgent
.
trigger
(
wantAgent
,
triggerInfo
,
triggerCallback
);
...
...
@@ -843,8 +843,8 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent1
;
var
wantAgent2
;
let
wantAgent1
;
let
wantAgent2
;
//getWantAgent回调
function
getWantAgentCallback
(
err
,
data
)
{
...
...
@@ -857,7 +857,7 @@ function getWantAgentCallback(err, data) {
}
}
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -927,11 +927,11 @@ import WantAgent from '@ohos.app.ability.wantAgent';
//wantAgent对象
var
wantAgent1
;
var
wantAgent2
;
let
wantAgent1
;
let
wantAgent2
;
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -994,10 +994,10 @@ getOperationType(agent: WantAgent, callback: AsyncCallback\<number>): void;
import
WantAgent
from
'
@ohos.app.ability.wantAgent
'
;
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -1032,7 +1032,7 @@ try {
WantAgent
.
getOperationType
(
wantAgent
,
(
OperationType
)
=>
{
console
.
log
(
'
----------- getOperationType ----------, OperationType:
'
+
OperationType
);
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
@@ -1064,10 +1064,10 @@ getOperationType(agent: WantAgent): Promise\<number>;
import
WantAgent
from
'
@ohos.app.ability.wantAgent
'
;
//wantAgent对象
var
wantAgent
;
let
wantAgent
;
//WantAgentInfo对象
var
wantAgentInfo
=
{
let
wantAgentInfo
=
{
wants
:
[
{
deviceId
:
'
deviceId
'
,
...
...
@@ -1104,7 +1104,7 @@ try {
console
.
log
(
'
getOperationType success, OperationType:
'
+
OperationType
);
}).
catch
((
err
)
=>
{
console
.
log
(
'
getOperationType fail, err:
'
+
err
);
})
})
;
}
catch
(
paramError
)
{
console
.
log
(
'
error:
'
+
paramError
.
code
+
'
,
'
+
paramError
.
message
);
}
...
...
zh-cn/application-dev/reference/apis/js-apis-application-configuration.md
浏览文件 @
2bfb0cc3
...
...
@@ -18,9 +18,8 @@
**示例:**
```
ts
import
hilog
from
'
@ohos.hilog
'
;
import
Ability
from
'
@ohos.application.Ability
'
import
Window
from
'
@ohos.window
'
import
Ability
from
'
@ohos.application.Ability
'
;
import
Window
from
'
@ohos.window
'
;
export
default
class
MainAbility
extends
Ability
{
onCreate
(
want
,
launchParam
)
{
...
...
@@ -43,12 +42,10 @@ export default class MainAbility extends Ability {
windowStage
.
loadContent
(
'
pages/index
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
ERROR
);
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
Failed to load the content. Cause: %{public}s
'
,
JSON
.
stringify
(
err
)
??
''
);
console
.
error
(
'
failed to load the content, error: + ${JSON.stringify(err)}
'
);
return
;
}
hilog
.
isLoggable
(
0x0000
,
'
testTag
'
,
hilog
.
LogLevel
.
INFO
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
Succeeded in loading the content. Data: %{public}s
'
,
JSON
.
stringify
(
data
)
??
''
);
console
.
info
(
'
Succeeded in loading the content, data: + ${JSON.stringify(data)}
'
);
});
}
}
...
...
zh-cn/application-dev/reference/apis/js-apis-application-formHost.md
浏览文件 @
2bfb0cc3
...
...
@@ -34,7 +34,7 @@ deleteForm(formId: string, callback: AsyncCallback<void>): void
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
deleteForm
(
formId
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost deleteForm, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -67,7 +67,7 @@ deleteForm(formId: string): Promise<void>
**参数:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
deleteForm
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost deleteForm success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -95,7 +95,7 @@ releaseForm(formId: string, callback: AsyncCallback<void>): void
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
releaseForm
(
formId
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost releaseForm, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -124,7 +124,7 @@ releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback<
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
releaseForm
(
formId
,
true
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost releaseForm, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -158,7 +158,7 @@ releaseForm(formId: string, isReleaseCache?: boolean): Promise<void>
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
releaseForm
(
formId
,
true
).
then
(()
=>
{
console
.
log
(
'
formHost releaseForm success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -186,7 +186,7 @@ requestForm(formId: string, callback: AsyncCallback<void>): void
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
requestForm
(
formId
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost requestForm, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -219,7 +219,7 @@ requestForm(formId: string): Promise<void>
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
requestForm
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost requestForm success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -247,7 +247,7 @@ castTempForm(formId: string, callback: AsyncCallback<void>): void
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
castTempForm
(
formId
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost castTempForm, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -280,7 +280,7 @@ castTempForm(formId: string): Promise<void>
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
castTempForm
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost castTempForm success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -308,7 +308,7 @@ notifyVisibleForms(formIds: Array<string>, callback: AsyncCallback<void
**示例:**
```
ts
var
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
notifyVisibleForms
(
formId
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost notifyVisibleForms, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -341,7 +341,7 @@ notifyVisibleForms(formIds: Array<string>): Promise<void>
**示例:**
```
ts
var
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
notifyVisibleForms
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost notifyVisibleForms success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -369,7 +369,7 @@ notifyInvisibleForms(formIds: Array<string>, callback: AsyncCallback<vo
**示例:**
```
ts
var
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
notifyInvisibleForms
(
formId
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost notifyInvisibleForms, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -402,7 +402,7 @@ notifyInvisibleForms(formIds: Array<string>): Promise<void>
**示例:**
```
ts
var
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
notifyInvisibleForms
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost notifyInvisibleForms success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -430,7 +430,7 @@ enableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void&
**示例:**
```
ts
var
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
enableFormsUpdate
(
formId
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost enableFormsUpdate, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -463,7 +463,7 @@ enableFormsUpdate(formIds: Array<string>): Promise<void>
**示例:**
```
ts
var
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
enableFormsUpdate
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost enableFormsUpdate success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -491,7 +491,7 @@ disableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void
**示例:**
```
ts
var
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
disableFormsUpdate
(
formId
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost disableFormsUpdate, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -524,7 +524,7 @@ disableFormsUpdate(formIds: Array<string>): Promise<void>
**示例:**
```
ts
var
formId
=
[
'
12400633174999288
'
];
let
formId
=
[
'
12400633174999288
'
];
formHost
.
disableFormsUpdate
(
formId
).
then
(()
=>
{
console
.
log
(
'
formHost disableFormsUpdate success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -549,7 +549,7 @@ isSystemReady(callback: AsyncCallback<void>): void
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
isSystemReady
((
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost isSystemReady, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -574,7 +574,7 @@ isSystemReady(): Promise<void>
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formHost
.
isSystemReady
().
then
(()
=>
{
console
.
log
(
'
formHost isSystemReady success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -748,7 +748,7 @@ deleteInvalidForms(formIds: Array<string>, callback: AsyncCallback<numb
**示例:**
```
ts
var
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
let
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
formHost
.
deleteInvalidForms
(
formIds
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost deleteInvalidForms, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -783,7 +783,7 @@ deleteInvalidForms(formIds: Array<string>): Promise<number>
**示例:**
```
ts
var
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
let
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
formHost
.
deleteInvalidForms
(
formIds
).
then
((
data
)
=>
{
console
.
log
(
'
formHost deleteInvalidForms, data:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
...
...
@@ -811,7 +811,7 @@ acquireFormState(want: Want, callback: AsyncCallback<formInfo.FormStateInfo&g
**示例:**
```
ts
var
want
=
{
let
want
=
{
'
deviceId
'
:
''
,
'
bundleName
'
:
'
ohos.samples.FormApplication
'
,
'
abilityName
'
:
'
FormAbility
'
,
...
...
@@ -855,7 +855,7 @@ acquireFormState(want: Want): Promise<formInfo.FormStateInfo>
**示例:**
```
ts
var
want
=
{
let
want
=
{
'
deviceId
'
:
''
,
'
bundleName
'
:
'
ohos.samples.FormApplication
'
,
'
abilityName
'
:
'
FormAbility
'
,
...
...
@@ -941,7 +941,7 @@ notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: A
**示例:**
```
ts
var
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
let
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
formHost
.
notifyFormsVisible
(
formIds
,
true
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost notifyFormsVisible, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -975,7 +975,7 @@ notifyFormsVisible(formIds: Array<string>, isVisible: boolean): Promise<
**示例:**
```
ts
var
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
let
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
formHost
.
notifyFormsVisible
(
formIds
,
true
).
then
(()
=>
{
console
.
log
(
'
formHost notifyFormsVisible success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -1004,7 +1004,7 @@ notifyFormsEnableUpdate(formIds: Array<string>, isEnableUpdate: boolean, c
**示例:**
```
ts
var
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
let
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
formHost
.
notifyFormsEnableUpdate
(
formIds
,
true
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost notifyFormsEnableUpdate, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -1038,7 +1038,7 @@ notifyFormsEnableUpdate(formIds: Array<string>, isEnableUpdate: boolean):
**示例:**
```
ts
var
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
let
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
formHost
.
notifyFormsEnableUpdate
(
formIds
,
true
).
then
(()
=>
{
console
.
log
(
'
formHost notifyFormsEnableUpdate success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -1066,8 +1066,8 @@ shareForm(formId: string, deviceId: string, callback: AsyncCallback<void>)
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
var
deviceId
=
'
EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2
'
;
let
formId
=
'
12400633174999288
'
;
let
deviceId
=
'
EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2
'
;
formHost
.
shareForm
(
formId
,
deviceId
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formHost shareForm, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -1101,8 +1101,8 @@ shareForm(formId: string, deviceId: string): Promise<void>
**参数:**
```
ts
var
formId
=
'
12400633174999288
'
;
var
deviceId
=
'
EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2
'
;
let
formId
=
'
12400633174999288
'
;
let
deviceId
=
'
EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2
'
;
formHost
.
shareForm
(
formId
,
deviceId
).
then
(()
=>
{
console
.
log
(
'
formHost shareForm success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -1126,7 +1126,7 @@ notifyFormsPrivacyProtected(formIds: Array\<string>, isProtected: boolean, callb
| deviceId | string | 是 | 远程设备标识。 |
```
ts
var
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
let
formIds
=
new
Array
(
'
12400633174999288
'
,
'
12400633174999289
'
);
formHost
.
notifyFormsPrivacyProtected
(
formIds
,
true
).
then
(()
=>
{
console
.
log
(
'
formHost shareForm success
'
);
}).
catch
((
error
)
=>
{
...
...
zh-cn/application-dev/reference/apis/js-apis-application-formProvider.md
浏览文件 @
2bfb0cc3
...
...
@@ -31,7 +31,7 @@ setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback&l
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formProvider
.
setFormNextRefreshTime
(
formId
,
5
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
console
.
log
(
'
formProvider setFormNextRefreshTime, error:
'
+
JSON
.
stringify
(
error
));
...
...
@@ -63,7 +63,7 @@ setFormNextRefreshTime(formId: string, minute: number): Promise<void>
**示例:**
```
ts
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
formProvider
.
setFormNextRefreshTime
(
formId
,
5
).
then
(()
=>
{
console
.
log
(
'
formProvider setFormNextRefreshTime success
'
);
}).
catch
((
error
)
=>
{
...
...
@@ -91,7 +91,7 @@ updateForm(formId: string, formBindingData: formBindingData.FormBindingData,call
```
ts
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
let
obj
=
formBindingData
.
createFormBindingData
({
temperature
:
'
22c
'
,
time
:
'
22:00
'
});
formProvider
.
updateForm
(
formId
,
obj
,
(
error
,
data
)
=>
{
if
(
error
.
code
)
{
...
...
@@ -125,7 +125,7 @@ updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Pr
```
ts
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
var
formId
=
'
12400633174999288
'
;
let
formId
=
'
12400633174999288
'
;
let
obj
=
formBindingData
.
createFormBindingData
({
temperature
:
'
22c
'
,
time
:
'
22:00
'
});
formProvider
.
updateForm
(
formId
,
obj
).
then
(()
=>
{
console
.
log
(
'
formProvider updateForm success
'
);
...
...
@@ -248,7 +248,7 @@ requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData,
```
ts
import
formBindingData
from
'
@ohos.application.formBindingData
'
;
var
want
=
{
let
want
=
{
abilityName
:
'
FormAbility
'
,
parameters
:
{
'
ohos.extra.param.key.form_dimension
'
:
2
,
...
...
@@ -286,7 +286,7 @@ requestPublishForm(want: Want, callback: AsyncCallback<string>): void
**示例:**
```
ts
var
want
=
{
let
want
=
{
abilityName
:
'
FormAbility
'
,
parameters
:
{
'
ohos.extra.param.key.form_dimension
'
:
2
,
...
...
@@ -329,7 +329,7 @@ requestPublishForm(want: Want, formBindingData?: formBindingData.FormBindingData
**示例:**
```
ts
var
want
=
{
let
want
=
{
abilityName
:
'
FormAbility
'
,
parameters
:
{
'
ohos.extra.param.key.form_dimension
'
:
2
,
...
...
@@ -368,7 +368,7 @@ formProvider.isRequestPublishFormSupported((error, isSupported) => {
console
.
log
(
'
formProvider isRequestPublishFormSupported, error:
'
+
JSON
.
stringify
(
error
));
}
else
{
if
(
isSupported
)
{
var
want
=
{
let
want
=
{
abilityName
:
'
FormAbility
'
,
parameters
:
{
'
ohos.extra.param.key.form_dimension
'
:
2
,
...
...
@@ -409,7 +409,7 @@ isRequestPublishFormSupported(): Promise<boolean>
```
ts
formProvider
.
isRequestPublishFormSupported
().
then
((
isSupported
)
=>
{
if
(
isSupported
)
{
var
want
=
{
let
want
=
{
abilityName
:
'
FormAbility
'
,
parameters
:
{
'
ohos.extra.param.key.form_dimension
'
:
2
,
...
...
zh-cn/application-dev/reference/apis/js-apis-application-want.md
浏览文件 @
2bfb0cc3
...
...
@@ -34,7 +34,7 @@ import Want from '@ohos.application.Want';
-
基础用法
```
ts
var
want
=
{
let
want
=
{
'
deviceId
'
:
''
,
// deviceId为空表示本设备
'
bundleName
'
:
'
com.extreme.test
'
,
'
abilityName
'
:
'
MainAbility
'
,
...
...
@@ -110,13 +110,13 @@ import Want from '@ohos.application.Want';
* 文件描述符(FD)
```ts
import fileio from '@ohos.fileio';
var
fd;
let
fd;
try {
fd = fileio.openSync('/data/storage/el2/base/haps/pic.png');
} catch(e) {
console.log('openSync fail:' + JSON.stringify(e));
}
var
want = {
let
want = {
'deviceId': '', // deviceId为空表示本设备
'bundleName': 'com.extreme.test',
'abilityName': 'MainAbility',
...
...
zh-cn/application-dev/reference/apis/js-apis-application-windowExtensionAbility.md
浏览文件 @
2bfb0cc3
...
...
@@ -101,7 +101,7 @@ export default class MyWindowExtensionAbility extends WindowExtensionAbility {
window
.
loadContent
(
'
WindowExtAbility/pages/index1
'
).
then
(()
=>
{
window
.
getProperties
().
then
((
pro
)
=>
{
console
.
log
(
'
WindowExtension
'
+
JSON
.
stringify
(
pro
));
})
})
;
window
.
show
();
})
}
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md
浏览文件 @
2bfb0cc3
...
...
@@ -35,13 +35,13 @@ addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<void>): void
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
}
var
monitor
=
{
let
monitor
=
{
abilityName
:
'
abilityname
'
,
onAbilityCreate
:
onAbilityCreateCallback
};
...
...
@@ -75,13 +75,13 @@ addAbilityMonitor(monitor: AbilityMonitor): Promise\<void>;
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
}
var
monitor
=
{
let
monitor
=
{
abilityName
:
'
abilityname
'
,
onAbilityCreate
:
onAbilityCreateCallback
};
...
...
@@ -112,13 +112,13 @@ removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<void>): v
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
}
var
monitor
=
{
let
monitor
=
{
abilityName
:
'
abilityname
'
,
onAbilityCreate
:
onAbilityCreateCallback
};
...
...
@@ -154,13 +154,13 @@ removeAbilityMonitor(monitor: AbilityMonitor): Promise\<void>;
-
示例
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
}
var
monitor
=
{
let
monitor
=
{
abilityName
:
'
abilityname
'
,
onAbilityCreate
:
onAbilityCreateCallback
};
...
...
@@ -191,13 +191,13 @@ waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<UIAbility>)
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
}
var
monitor
=
{
let
monitor
=
{
abilityName
:
'
abilityname
'
,
onAbilityCreate
:
onAbilityCreateCallback
};
...
...
@@ -227,14 +227,14 @@ waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCall
**示例:**
```
ts
var
abilityDelegator
;
var
timeout
=
100
;
let
abilityDelegator
;
let
timeout
=
100
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
}
var
monitor
=
{
let
monitor
=
{
abilityName
:
'
abilityname
'
,
onAbilityCreate
:
onAbilityCreateCallback
};
...
...
@@ -271,13 +271,13 @@ waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise\<UIAbilit
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
}
var
monitor
=
{
let
monitor
=
{
abilityName
:
'
abilityname
'
,
onAbilityCreate
:
onAbilityCreateCallback
};
...
...
@@ -307,10 +307,10 @@ getAppContext(): Context;
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
var
context
=
abilityDelegator
.
getAppContext
();
let
context
=
abilityDelegator
.
getAppContext
();
```
...
...
@@ -338,14 +338,14 @@ getAbilityState(ability: UIAbility): number;
**示例:**
```
ts
var
abilityDelegator
;
var
ability
;
let
abilityDelegator
;
let
ability
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
getCurrentTopAbility
((
err
:
any
,
data
:
any
)
=>
{
console
.
info
(
'
getCurrentTopAbility callback
'
);
ability
=
data
;
var
state
=
abilityDelegator
.
getAbilityState
(
ability
);
let
state
=
abilityDelegator
.
getAbilityState
(
ability
);
console
.
info
(
'
getAbilityState
'
+
state
);
});
```
...
...
@@ -369,8 +369,8 @@ getCurrentTopAbility(callback: AsyncCallback\<UIAbility>): void;
**示例:**
```
ts
var
abilityDelegator
;
var
ability
;
let
abilityDelegator
;
let
ability
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
getCurrentTopAbility
((
err
:
any
,
data
:
any
)
=>
{
...
...
@@ -398,8 +398,8 @@ getCurrentTopAbility(): Promise\<UIAbility>;
**示例:**
```
ts
var
abilityDelegator
;
var
ability
;
let
abilityDelegator
;
let
ability
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
getCurrentTopAbility
().
then
((
data
:
any
)
=>
{
...
...
@@ -428,8 +428,8 @@ startAbility(want: Want, callback: AsyncCallback\<void>): void;
**示例:**
```
ts
var
abilityDelegator
;
var
want
=
{
let
abilityDelegator
;
let
want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
};
...
...
@@ -465,8 +465,8 @@ startAbility(want: Want): Promise\<void>;
**示例:**
```
ts
var
abilityDelegator
;
var
want
=
{
let
abilityDelegator
;
let
want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
};
...
...
@@ -497,8 +497,8 @@ doAbilityForeground(ability: UIAbility, callback: AsyncCallback\<void>): void;
**示例:**
```
ts
var
abilityDelegator
;
var
ability
;
let
abilityDelegator
;
let
ability
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
getCurrentTopAbility
((
err
:
any
,
data
:
any
)
=>
{
...
...
@@ -535,8 +535,8 @@ doAbilityForeground(ability: UIAbility): Promise\<void>;
**示例:**
```
ts
var
abilityDelegator
;
var
ability
;
let
abilityDelegator
;
let
ability
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
getCurrentTopAbility
((
err
:
any
,
data
:
any
)
=>
{
...
...
@@ -568,8 +568,8 @@ doAbilityBackground(ability: UIAbility, callback: AsyncCallback\<void>): void;
**示例:**
```
ts
var
abilityDelegator
;
var
ability
;
let
abilityDelegator
;
let
ability
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
getCurrentTopAbility
((
err
:
any
,
data
:
any
)
=>
{
...
...
@@ -606,8 +606,8 @@ doAbilityBackground(ability: UIAbility): Promise\<void>;
**示例:**
```
ts
var
abilityDelegator
;
var
ability
;
let
abilityDelegator
;
let
ability
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
getCurrentTopAbility
((
err
:
any
,
data
:
any
)
=>
{
...
...
@@ -638,8 +638,8 @@ printSync(msg: string): void;
**示例:**
```
ts
var
abilityDelegator
;
var
msg
=
'
msg
'
;
let
abilityDelegator
;
let
msg
=
'
msg
'
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
printSync
(
msg
);
...
...
@@ -665,8 +665,8 @@ print(msg: string, callback: AsyncCallback\<void>): void;
**示例:**
```
ts
var
abilityDelegator
;
var
msg
=
'
msg
'
;
let
abilityDelegator
;
let
msg
=
'
msg
'
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
print
(
msg
,
(
err
:
any
)
=>
{
...
...
@@ -699,8 +699,8 @@ print(msg: string): Promise\<void>;
**示例:**
```
ts
var
abilityDelegator
;
var
msg
=
'
msg
'
;
let
abilityDelegator
;
let
msg
=
'
msg
'
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
print
(
msg
).
then
(()
=>
{
...
...
@@ -728,8 +728,8 @@ executeShellCommand(cmd: string, callback: AsyncCallback\<ShellCmdResult>): void
**示例:**
```
ts
var
abilityDelegator
;
var
cmd
=
'
cmd
'
;
let
abilityDelegator
;
let
cmd
=
'
cmd
'
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
executeShellCommand
(
cmd
,
(
err
:
any
,
data
:
any
)
=>
{
...
...
@@ -758,9 +758,9 @@ executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback\<S
**示例:**
```
ts
var
abilityDelegator
;
var
cmd
=
'
cmd
'
;
var
timeout
=
100
;
let
abilityDelegator
;
let
cmd
=
'
cmd
'
;
let
timeout
=
100
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
executeShellCommand
(
cmd
,
timeout
,
(
err
:
any
,
data
:
any
)
=>
{
...
...
@@ -794,9 +794,9 @@ executeShellCommand(cmd: string, timeoutSecs?: number): Promise\<ShellCmdResult>
**示例:**
```
ts
var
abilityDelegator
;
var
cmd
=
'
cmd
'
;
var
timeout
=
100
;
let
abilityDelegator
;
let
cmd
=
'
cmd
'
;
let
timeout
=
100
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
executeShellCommand
(
cmd
,
timeout
).
then
((
data
:
any
)
=>
{
...
...
@@ -825,8 +825,8 @@ finishTest(msg: string, code: number, callback: AsyncCallback\<void>): void;
**示例:**
```
ts
var
abilityDelegator
;
var
msg
=
'
msg
'
;
let
abilityDelegator
;
let
msg
=
'
msg
'
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
finishTest
(
msg
,
0
,
(
err
:
any
)
=>
{
...
...
@@ -860,8 +860,8 @@ finishTest(msg: string, code: number): Promise\<void>;
**示例:**
```
ts
var
abilityDelegator
;
var
msg
=
'
msg
'
;
let
abilityDelegator
;
let
msg
=
'
msg
'
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
finishTest
(
msg
,
0
).
then
(()
=>
{
...
...
@@ -887,9 +887,9 @@ addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<vo
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
var
monitor
=
{
let
monitor
=
{
moduleName
:
'
moduleName
'
,
srcEntrance
:
'
srcEntrance
'
,
};
...
...
@@ -925,9 +925,9 @@ addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\<void>;
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
var
monitor
=
{
let
monitor
=
{
moduleName
:
'
moduleName
'
,
srcEntrance
:
'
srcEntrance
'
,
};
...
...
@@ -956,9 +956,9 @@ removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
var
monitor
=
{
let
monitor
=
{
moduleName
:
'
moduleName
'
,
srcEntrance
:
'
srcEntrance
'
,
};
...
...
@@ -994,9 +994,9 @@ removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\<void>;
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
var
monitor
=
{
let
monitor
=
{
moduleName
:
'
moduleName
'
,
srcEntrance
:
'
srcEntrance
'
,
};
...
...
@@ -1025,13 +1025,13 @@ waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<A
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
}
var
monitor
=
{
let
monitor
=
{
moduleName
:
'
moduleName
'
,
srcEntrance
:
'
srcEntrance
'
,
};
...
...
@@ -1066,13 +1066,13 @@ waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise
**示例:**
```
ts
var
abilityDelegator
;
let
abilityDelegator
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
}
var
monitor
=
{
let
monitor
=
{
moduleName
:
'
moduleName
'
,
srcEntrance
:
'
srcEntrance
'
,
};
...
...
@@ -1102,14 +1102,14 @@ waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback:
**示例:**
```
ts
var
abilityDelegator
;
var
timeout
=
100
;
let
abilityDelegator
;
let
timeout
=
100
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
'
onAbilityCreateCallback
'
);
}
var
monitor
=
{
let
monitor
=
{
moduleName
:
'
moduleName
'
,
srcEntrance
:
'
srcEntrance
'
,
};
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md
浏览文件 @
2bfb0cc3
...
...
@@ -50,7 +50,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.example.formstartability
'
,
abilityName
:
'
MainAbility
'
,
...
...
@@ -94,7 +94,7 @@ startAbility(want: Want): Promise<void>
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.example.formstartability
'
,
abilityName
:
'
MainAbility
'
,
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-processData.md
浏览文件 @
2bfb0cc3
...
...
@@ -16,7 +16,7 @@
**示例:**
```
ts
import
appManager
from
'
@ohos.application.appManager
'
import
appManager
from
'
@ohos.application.appManager
'
;
let
applicationStateObserver
=
{
onForegroundApplicationChanged
(
appStateData
)
{
...
...
@@ -38,6 +38,6 @@ let applicationStateObserver = {
console
.
log
(
'
onProcessStateChanged processData.isContinuousTask :
'
+
JSON
.
stringify
(
processData
.
isContinuousTask
));
console
.
log
(
'
onProcessStateChanged processData.isKeepAlive :
'
+
JSON
.
stringify
(
processData
.
isKeepAlive
));
}
}
}
;
let
observerCode
=
appManager
.
registerApplicationStateObserver
(
applicationStateObserver
);
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md
浏览文件 @
2bfb0cc3
...
...
@@ -66,7 +66,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
**示例:**
```
ts
var
want
=
{
let
want
=
{
bundleName
:
'
com.example.myapp
'
,
abilityName
:
'
MyAbility
'
};
...
...
@@ -138,12 +138,12 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
options
=
{
let
options
=
{
windowMode
:
0
};
...
...
@@ -218,11 +218,11 @@ startAbility(want: Want, options?: StartOptions): Promise<void>;
**示例:**
```
ts
var
want
=
{
let
want
=
{
bundleName
:
'
com.example.myapp
'
,
abilityName
:
'
MyAbility
'
};
var
options
=
{
let
options
=
{
windowMode
:
0
,
};
...
...
@@ -295,7 +295,7 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>):
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
...
...
@@ -371,12 +371,12 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
options
=
{
let
options
=
{
windowMode
:
0
,
};
...
...
@@ -457,11 +457,11 @@ startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityRes
**示例:**
```
ts
var
want
=
{
let
want
=
{
bundleName
:
'
com.example.myapp
'
,
abilityName
:
'
MyAbility
'
};
var
options
=
{
let
options
=
{
windowMode
:
0
,
};
...
...
@@ -531,12 +531,12 @@ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncC
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
let
accountId
=
100
;
try
{
this
.
context
.
startAbilityForResultWithAccount
(
want
,
accountId
,
(
error
,
result
)
=>
{
...
...
@@ -607,13 +607,13 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOp
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
var
options
=
{
let
accountId
=
100
;
let
options
=
{
windowMode
:
0
};
...
...
@@ -691,13 +691,13 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
var
options
=
{
let
accountId
=
100
;
let
options
=
{
windowMode
:
0
};
...
...
@@ -756,7 +756,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
...
...
@@ -816,7 +816,7 @@ startServiceExtensionAbility(want: Want): Promise\<void>;
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
...
...
@@ -877,12 +877,12 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
let
accountId
=
100
;
try
{
this
.
context
.
startServiceExtensionAbilityWithAccount
(
want
,
accountId
,
(
error
)
=>
{
...
...
@@ -942,12 +942,12 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
let
accountId
=
100
;
try
{
this
.
context
.
startServiceExtensionAbilityWithAccount
(
want
,
accountId
)
...
...
@@ -1000,7 +1000,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
...
...
@@ -1057,7 +1057,7 @@ stopServiceExtensionAbility(want: Want): Promise\<void>;
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
...
...
@@ -1119,12 +1119,12 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
let
accountId
=
100
;
try
{
this
.
context
.
stopServiceExtensionAbilityWithAccount
(
want
,
accountId
,
(
error
)
=>
{
...
...
@@ -1181,12 +1181,12 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\<
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
let
accountId
=
100
;
try
{
this
.
context
.
stopServiceExtensionAbilityWithAccount
(
want
,
accountId
)
...
...
@@ -1315,13 +1315,13 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi
**示例:**
```
ts
var
want
=
{
let
want
=
{
bundleName
:
'
com.extreme.myapplication
'
,
abilityName
:
'
SecondAbility
'
}
var
resultCode
=
100
;
let
resultCode
=
100
;
// 返回给接口调用方AbilityResult信息
var
abilityResult
=
{
let
abilityResult
=
{
want
,
resultCode
}
...
...
@@ -1380,13 +1380,13 @@ terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
**示例:**
```
ts
var
want
=
{
let
want
=
{
bundleName
:
'
com.extreme.myapplication
'
,
abilityName
:
'
SecondAbility
'
}
var
resultCode
=
100
;
let
resultCode
=
100
;
// 返回给接口调用方AbilityResult信息
var
abilityResult
=
{
let
abilityResult
=
{
want
,
resultCode
}
...
...
@@ -1445,18 +1445,18 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
options
=
{
let
options
=
{
onConnect
(
elementName
,
remote
)
{
console
.
log
(
'
----------- onConnect -----------
'
)
},
onDisconnect
(
elementName
)
{
console
.
log
(
'
----------- onDisconnect -----------
'
)
},
onFailed
(
code
)
{
console
.
log
(
'
----------- onFailed -----------
'
)
}
}
var
connection
=
null
;
let
connection
=
null
;
try
{
connection
=
this
.
context
.
connectServiceExtensionAbility
(
want
,
options
);
}
catch
(
paramError
)
{
...
...
@@ -1509,19 +1509,19 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
var
options
=
{
let
accountId
=
100
;
let
options
=
{
onConnect
(
elementName
,
remote
)
{
console
.
log
(
'
----------- onConnect -----------
'
)
},
onDisconnect
(
elementName
)
{
console
.
log
(
'
----------- onDisconnect -----------
'
)
},
onFailed
(
code
)
{
console
.
log
(
'
----------- onFailed -----------
'
)
}
}
var
connection
=
null
;
let
connection
=
null
;
try
{
connection
=
this
.
context
.
connectServiceExtensionAbilityWithAccount
(
want
,
accountId
,
options
);
}
catch
(
paramError
)
{
...
...
@@ -1568,7 +1568,7 @@ disconnectServiceExtensionAbility(connection: number): Promise\<void>;
```
ts
// connection为connectServiceExtensionAbility中的返回值
var
connection
=
1
;
let
connection
=
1
;
try
{
this
.
context
.
disconnectServiceExtensionAbility
(
connection
)
...
...
@@ -1620,7 +1620,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback\<vo
```
ts
// connection为connectServiceExtensionAbility中的返回值
var
connection
=
1
;
let
connection
=
1
;
try
{
this
.
context
.
disconnectServiceExtensionAbility
(
connection
,
(
error
)
=>
{
...
...
@@ -1670,10 +1670,10 @@ startAbilityByCall(want: Want): Promise<Caller>;
后台启动:
```
ts
var
caller
=
undefined
;
let
caller
=
undefined
;
// 后台启动Ability,不配置parameters
var
wantBackground
=
{
let
wantBackground
=
{
bundleName
:
'
com.example.myservice
'
,
moduleName
:
'
entry
'
,
abilityName
:
'
MainAbility
'
,
...
...
@@ -1701,10 +1701,10 @@ startAbilityByCall(want: Want): Promise<Caller>;
前台启动:
```
ts
var
caller
=
undefined
;
let
caller
=
undefined
;
// 前台启动Ability,将parameters中的'ohos.aafwk.param.callAbilityToForeground'配置为true
var
wantForeground
=
{
let
wantForeground
=
{
bundleName
:
'
com.example.myservice
'
,
moduleName
:
'
entry
'
,
abilityName
:
'
MainAbility
'
,
...
...
@@ -1780,12 +1780,12 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
let
accountId
=
100
;
try
{
this
.
context
.
startAbilityWithAccount
(
want
,
accountId
,
(
error
)
=>
{
...
...
@@ -1855,13 +1855,13 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
var
options
=
{
let
accountId
=
100
;
let
options
=
{
windowMode
:
0
};
...
...
@@ -1932,13 +1932,13 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions):
**示例:**
```
ts
var
want
=
{
let
want
=
{
deviceId
:
''
,
bundleName
:
'
com.extreme.test
'
,
abilityName
:
'
MainAbility
'
};
var
accountId
=
100
;
var
options
=
{
let
accountId
=
100
;
let
options
=
{
windowMode
:
0
};
...
...
@@ -1978,7 +1978,7 @@ requestPermissionsFromUser(permissions: Array<string>, requestCallback: As
**示例:**
```
ts
var
permissions
=
[
'
com.example.permission
'
]
let
permissions
=
[
'
com.example.permission
'
]
this
.
context
.
requestPermissionsFromUser
(
permissions
,(
result
)
=>
{
console
.
log
(
'
requestPermissionsFromUserresult:
'
+
JSON
.
stringify
(
result
));
});
...
...
@@ -2009,7 +2009,7 @@ requestPermissionsFromUser(permissions: Array<string>) : Promise<Permis
**示例:**
```
ts
var
permissions
=
[
'
com.example.permission
'
]
let
permissions
=
[
'
com.example.permission
'
]
this
.
context
.
requestPermissionsFromUser
(
permissions
).
then
((
data
)
=>
{
console
.
log
(
'
success:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
...
...
@@ -2093,9 +2093,9 @@ setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\<void>): void;
```
ts
import
image
from
'
@ohos.multimedia.image
'
;
var
imagePixelMap
;
var
color
=
new
ArrayBuffer
(
0
);
var
initializationOptions
=
{
let
imagePixelMap
;
let
color
=
new
ArrayBuffer
(
0
);
let
initializationOptions
=
{
size
:
{
height
:
100
,
width
:
100
...
...
@@ -2140,9 +2140,9 @@ setMissionIcon(icon: image.PixelMap): Promise\<void>;
```
ts
import
image
from
'
@ohos.multimedia.image
'
;
var
imagePixelMap
;
var
color
=
new
ArrayBuffer
(
0
);
var
initializationOptions
=
{
let
imagePixelMap
;
let
color
=
new
ArrayBuffer
(
0
);
let
initializationOptions
=
{
size
:
{
height
:
100
,
width
:
100
...
...
@@ -2180,7 +2180,7 @@ restoreWindowStage(localStorage: LocalStorage) : void;
**示例:**
```
ts
var
storage
=
new
LocalStorage
();
let
storage
=
new
LocalStorage
();
this
.
context
.
restoreWindowStage
(
storage
);
```
...
...
@@ -2201,6 +2201,6 @@ isTerminating(): boolean;
**示例:**
```
ts
var
isTerminating
=
this
.
context
.
isTerminating
();
let
isTerminating
=
this
.
context
.
isTerminating
();
console
.
log
(
'
ability state :
'
+
isTerminating
);
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录