提交 f640ee54 编写于 作者: W wusongqing

updated docs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 98b36aa2
# Context Module # Context Module
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
```js ```js
...@@ -15,7 +18,7 @@ var context = featureAbility.getContext(); ...@@ -15,7 +18,7 @@ var context = featureAbility.getContext();
context.getOrCreateLocalDir() context.getOrCreateLocalDir()
``` ```
## Context.getOrCreateLocalDir ## Context.getOrCreateLocalDir<sup>7+</sup>
getOrCreateLocalDir(callback: AsyncCallback\<string>): void getOrCreateLocalDir(callback: AsyncCallback\<string>): void
...@@ -43,7 +46,7 @@ context.getOrCreateLocalDir((err, data)=>{ ...@@ -43,7 +46,7 @@ context.getOrCreateLocalDir((err, data)=>{
## Context.getOrCreateLocalDir ## Context.getOrCreateLocalDir<sup>7+</sup>
getOrCreateLocalDir(): Promise\<string> getOrCreateLocalDir(): Promise\<string>
...@@ -71,7 +74,7 @@ context.getOrCreateLocalDir().then((data) => { ...@@ -71,7 +74,7 @@ context.getOrCreateLocalDir().then((data) => {
## Context.verifyPermission ## Context.verifyPermission<sup>7+</sup>
verifyPermission(permission: string, options: PermissionOptions, callback: AsyncCallback\<number>): void verifyPermission(permission: string, options: PermissionOptions, callback: AsyncCallback\<number>): void
...@@ -100,7 +103,7 @@ bundle.getBundleInfo('com.context.test', 1, (datainfo) =>{ ...@@ -100,7 +103,7 @@ bundle.getBundleInfo('com.context.test', 1, (datainfo) =>{
## Context.verifyPermission ## Context.verifyPermission<sup>7+</sup>
verifyPermission(permission: string, callback: AsyncCallback\<number>): void verifyPermission(permission: string, callback: AsyncCallback\<number>): void
...@@ -123,7 +126,7 @@ var context = featureAbility.getContext(); ...@@ -123,7 +126,7 @@ var context = featureAbility.getContext();
context.verifyPermission("com.example.permission") context.verifyPermission("com.example.permission")
``` ```
## Context.verifyPermission ## Context.verifyPermission<sup>7+</sup>
verifyPermission(permission: string, options?: PermissionOptions): Promise\<number> verifyPermission(permission: string, options?: PermissionOptions): Promise\<number>
...@@ -158,7 +161,7 @@ context.verifyPermission('com.context.permission',Permission).then((data) => { ...@@ -158,7 +161,7 @@ context.verifyPermission('com.context.permission',Permission).then((data) => {
## Context.requestPermissionsFromUser ## Context.requestPermissionsFromUser<sup>7+</sup>
requestPermissionsFromUser(permissions: Array\<string>, requestCode: number, resultCallback: AsyncCallback<[PermissionRequestResult](#permissionrequestresult)>): void requestPermissionsFromUser(permissions: Array\<string>, requestCode: number, resultCallback: AsyncCallback<[PermissionRequestResult](#permissionrequestresult)>): void
...@@ -194,7 +197,7 @@ context.requestPermissionsFromUser( ...@@ -194,7 +197,7 @@ context.requestPermissionsFromUser(
## Context.getApplicationInfo ## Context.getApplicationInfo<sup>7+</sup>
getApplicationInfo(callback: AsyncCallback\<ApplicationInfo>): void getApplicationInfo(callback: AsyncCallback\<ApplicationInfo>): void
...@@ -218,7 +221,7 @@ context.getApplicationInfo() ...@@ -218,7 +221,7 @@ context.getApplicationInfo()
## Context.getApplicationInfo ## Context.getApplicationInfo<sup>7+</sup>
getApplicationInfo(): Promise\<ApplicationInfo> getApplicationInfo(): Promise\<ApplicationInfo>
...@@ -245,7 +248,7 @@ context.getApplicationInfo().then((data) => { ...@@ -245,7 +248,7 @@ context.getApplicationInfo().then((data) => {
## Context.getBundleName ## Context.getBundleName<sup>7+</sup>
getBundleName(callback: AsyncCallback\<string>): void getBundleName(callback: AsyncCallback\<string>): void
...@@ -269,7 +272,7 @@ context.getBundleName() ...@@ -269,7 +272,7 @@ context.getBundleName()
## Context.getBundleName ## Context.getBundleName<sup>7+</sup>
getBundleName(): Promise\<string> getBundleName(): Promise\<string>
...@@ -296,7 +299,7 @@ context.getBundleName().then((data) => { ...@@ -296,7 +299,7 @@ context.getBundleName().then((data) => {
## Context.getProcessInfo ## Context.getProcessInfo<sup>7+</sup>
getProcessInfo(callback: AsyncCallback\<ProcessInfo>): void getProcessInfo(callback: AsyncCallback\<ProcessInfo>): void
...@@ -320,7 +323,7 @@ context.getProcessInfo() ...@@ -320,7 +323,7 @@ context.getProcessInfo()
## Context.getProcessInfo ## Context.getProcessInfo<sup>7+</sup>
getProcessInfo(): Promise\<ProcessInfo> getProcessInfo(): Promise\<ProcessInfo>
...@@ -347,7 +350,7 @@ context.getProcessInfo().then((data) => { ...@@ -347,7 +350,7 @@ context.getProcessInfo().then((data) => {
## Context.getElementName ## Context.getElementName<sup>7+</sup>
getElementName(callback: AsyncCallback\<ElementName>): void getElementName(callback: AsyncCallback\<ElementName>): void
...@@ -373,7 +376,7 @@ context.getElementName() ...@@ -373,7 +376,7 @@ context.getElementName()
## Context.getElementName ## Context.getElementName<sup>7+</sup>
getElementName(): Promise\<ElementName> getElementName(): Promise\<ElementName>
...@@ -400,7 +403,7 @@ context.getElementName().then((data) => { ...@@ -400,7 +403,7 @@ context.getElementName().then((data) => {
}); });
``` ```
## Context.getProcessName ## Context.getProcessName<sup>7+</sup>
getProcessName(callback: AsyncCallback\<string>): void getProcessName(callback: AsyncCallback\<string>): void
...@@ -424,7 +427,7 @@ context.getProcessName() ...@@ -424,7 +427,7 @@ context.getProcessName()
## Context.getProcessName ## Context.getProcessName<sup>7+</sup>
getProcessName(): Promise\<string> getProcessName(): Promise\<string>
...@@ -451,7 +454,7 @@ context.getProcessName().then((data) => { ...@@ -451,7 +454,7 @@ context.getProcessName().then((data) => {
## Context.getCallingBundle ## Context.getCallingBundle<sup>7+</sup>
getCallingBundle(callback: AsyncCallback\<string>): void getCallingBundle(callback: AsyncCallback\<string>): void
...@@ -475,7 +478,7 @@ context.getCallingBundle() ...@@ -475,7 +478,7 @@ context.getCallingBundle()
## Context.getCallingBundle ## Context.getCallingBundle<sup>7+</sup>
getCallingBundle(): Promise\<string> getCallingBundle(): Promise\<string>
...@@ -606,7 +609,7 @@ context.getFilesDir().then((data) => { ...@@ -606,7 +609,7 @@ context.getFilesDir().then((data) => {
}); });
``` ```
## Context.getOrCreateDistributedDir ## Context.getOrCreateDistributedDir<sup>7+</sup>
getOrCreateDistributedDir(callback: AsyncCallback\<string>): void getOrCreateDistributedDir(callback: AsyncCallback\<string>): void
...@@ -636,7 +639,7 @@ context.getOrCreateDistributedDir((err, data) => { ...@@ -636,7 +639,7 @@ context.getOrCreateDistributedDir((err, data) => {
}); });
``` ```
## Context.getOrCreateDistributedDir ## Context.getOrCreateDistributedDir<sup>7+</sup>
getOrCreateDistributedDir(): Promise\<string> getOrCreateDistributedDir(): Promise\<string>
...@@ -662,7 +665,7 @@ context.getOrCreateDistributedDir().then((data) => { ...@@ -662,7 +665,7 @@ context.getOrCreateDistributedDir().then((data) => {
}); });
``` ```
## Context.getAppType ## Context.getAppType<sup>7+</sup>
getAppType(callback: AsyncCallback\<string>): void getAppType(callback: AsyncCallback\<string>): void
...@@ -690,7 +693,7 @@ context.getAppType((err, data) => { ...@@ -690,7 +693,7 @@ context.getAppType((err, data) => {
}); });
``` ```
## Context.getAppType ## Context.getAppType<sup>7+</sup>
getAppType(): Promise\<string> getAppType(): Promise\<string>
...@@ -714,7 +717,7 @@ context.getAppType().then((data) => { ...@@ -714,7 +717,7 @@ context.getAppType().then((data) => {
}); });
``` ```
## Context.getHapModuleInfo ## Context.getHapModuleInfo<sup>7+</sup>
getHapModuleInfo(callback: AsyncCallback\<HapModuleInfo>): void getHapModuleInfo(callback: AsyncCallback\<HapModuleInfo>): void
...@@ -742,7 +745,7 @@ context.getHapModuleInfo((err, data) => { ...@@ -742,7 +745,7 @@ context.getHapModuleInfo((err, data) => {
}); });
``` ```
## Context.getHapModuleInfo ## Context.getHapModuleInfo<sup>7+</sup>
getHapModuleInfo(): Promise\<HapModuleInfo> getHapModuleInfo(): Promise\<HapModuleInfo>
...@@ -766,7 +769,7 @@ context.getHapModuleInfo().then((data) => { ...@@ -766,7 +769,7 @@ context.getHapModuleInfo().then((data) => {
}); });
``` ```
## Context.getAppVersionInfo ## Context.getAppVersionInfo<sup>7+</sup>
getAppVersionInfo(callback: AsyncCallback\<HapModuleInfo>): void getAppVersionInfo(callback: AsyncCallback\<HapModuleInfo>): void
...@@ -794,7 +797,7 @@ context.getAppVersionInfo((err, data) => { ...@@ -794,7 +797,7 @@ context.getAppVersionInfo((err, data) => {
}); });
``` ```
## Context.getAppVersionInfo ## Context.getAppVersionInfo<sup>7+</sup>
getAppVersionInfo(): Promise\<AppVersionInfo> getAppVersionInfo(): Promise\<AppVersionInfo>
...@@ -818,7 +821,7 @@ context.getAppVersionInfo().then((data) => { ...@@ -818,7 +821,7 @@ context.getAppVersionInfo().then((data) => {
}); });
``` ```
## Context.getAbilityInfo ## Context.getAbilityInfo<sup>7+</sup>
getAbilityInfo(callback: AsyncCallback\<AbilityInfo>): void getAbilityInfo(callback: AsyncCallback\<AbilityInfo>): void
...@@ -846,7 +849,7 @@ context.getAbilityInfo((err, data) => { ...@@ -846,7 +849,7 @@ context.getAbilityInfo((err, data) => {
}); });
``` ```
## Context.getAbilityInfo ## Context.getAbilityInfo<sup>7+</sup>
getAbilityInfo(): Promise\<AbilityInfo> getAbilityInfo(): Promise\<AbilityInfo>
...@@ -870,7 +873,7 @@ context.getAbilityInfo().then((data) => { ...@@ -870,7 +873,7 @@ context.getAbilityInfo().then((data) => {
}); });
``` ```
## Context.getApplicationContext ## Context.getApplicationContext<sup>7+</sup>
getApplicationContext(): Context getApplicationContext(): Context
...@@ -891,7 +894,7 @@ import featureAbility from '@ohos.ability.featureAbility' ...@@ -891,7 +894,7 @@ import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext().getApplicationContext(); var context = featureAbility.getContext().getApplicationContext();
``` ```
## PermissionOptions ## PermissionOptions<sup>7+</sup>
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -900,7 +903,7 @@ var context = featureAbility.getContext().getApplicationContext(); ...@@ -900,7 +903,7 @@ var context = featureAbility.getContext().getApplicationContext();
| pid | Read-only | number | No | Process ID.| | pid | Read-only | number | No | Process ID.|
| uid | Read-only | number | No | User ID.| | uid | Read-only | number | No | User ID.|
## PermissionRequestResult ## PermissionRequestResult<sup>7+</sup>
**System capability**: SystemCapability.Ability.AbilityRuntime.Core **System capability**: SystemCapability.Ability.AbilityRuntime.Core
...@@ -910,7 +913,7 @@ var context = featureAbility.getContext().getApplicationContext(); ...@@ -910,7 +913,7 @@ var context = featureAbility.getContext().getApplicationContext();
| permissions | Read-only | Array\<string> | Yes | Permissions requested. | | permissions | Read-only | Array\<string> | Yes | Permissions requested. |
| authResults | Read-only | Array\<number> | Yes | Permission request result. | | authResults | Read-only | Array\<number> | Yes | Permission request result. |
## HapModuleInfo ## HapModuleInfo<sup>7+</sup>
Describes the HAP module information. Describes the HAP module information.
...@@ -933,7 +936,7 @@ Describes the HAP module information. ...@@ -933,7 +936,7 @@ Describes the HAP module information.
| installationFree | boolean | Yes | No | When installation-free is supported. | | installationFree | boolean | Yes | No | When installation-free is supported. |
| mainElementName | string | Yes| No| Information about the entry ability.| | mainElementName | string | Yes| No| Information about the entry ability.|
## AppVersionInfo ## AppVersionInfo<sup>7+</sup>
| Name | Type| Readable | Writable | Description| | Name | Type| Readable | Writable | Description|
| ------ | ------ | ------| ------ | ------ | | ------ | ------ | ------| ------ | ------ |
......
# ConfigurationConstant # ConfigurationConstant
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -34,7 +34,7 @@ ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT ...@@ -34,7 +34,7 @@ ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT
| COLOR_MODE_LIGHT | 1 | Light mode.| | COLOR_MODE_LIGHT | 1 | Light mode.|
## ConfigurationConstant.Direction ## ConfigurationConstant.Direction<sup>9+</sup>
The value is obtained through the **ConfigurationConstant.Direction** API. The value is obtained through the **ConfigurationConstant.Direction** API.
...@@ -48,12 +48,12 @@ ConfigurationConstant.Direction.DIRECTION_VERTICAL ...@@ -48,12 +48,12 @@ ConfigurationConstant.Direction.DIRECTION_VERTICAL
| Name| Value| Description| | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| DIRECTION_NOT_SET<sup>9+</sup> | -1 | Unspecified direction.| | DIRECTION_NOT_SET | -1 | Unspecified direction.|
| DIRECTION_VERTICAL<sup>9+</sup> | 0 | Vertical direction.| | DIRECTION_VERTICAL | 0 | Vertical direction.|
| DIRECTION_HORIZONTAL<sup>9+</sup> | 1 | Horizontal direction.| | DIRECTION_HORIZONTAL | 1 | Horizontal direction.|
## ConfigurationConstant.ScreenDensity ## ConfigurationConstant.ScreenDensity<sup>9+</sup>
The value is obtained through the **ConfigurationConstant.ScreenDensity** API. The value is obtained through the **ConfigurationConstant.ScreenDensity** API.
...@@ -67,10 +67,10 @@ ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET ...@@ -67,10 +67,10 @@ ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET
| Name| Value| Description| | Name| Value| Description|
| -------- | -------- | -------- | | -------- | -------- | -------- |
| SCREEN_DENSITY_NOT_SET<sup>9+</sup> | 0 | Unspecified screen resolution.| | SCREEN_DENSITY_NOT_SET | 0 | Unspecified screen resolution.|
| SCREEN_DENSITY_SDPI<sup>9+</sup> | 120 | The screen resolution is sdpi.| | SCREEN_DENSITY_SDPI | 120 | The screen resolution is sdpi.|
| SCREEN_DENSITY_MDPI<sup>9+</sup> | 160 | The screen resolution is mdpi.| | SCREEN_DENSITY_MDPI | 160 | The screen resolution is mdpi.|
| SCREEN_DENSITY_LDPI<sup>9+</sup> | 240 | The screen resolution is ldpi.| | SCREEN_DENSITY_LDPI | 240 | The screen resolution is ldpi.|
| SCREEN_DENSITY_XLDPI<sup>9+</sup> | 320 | The screen resolution is xldpi.| | SCREEN_DENSITY_XLDPI | 320 | The screen resolution is xldpi.|
| SCREEN_DENSITY_XXLDPI<sup>9+</sup> | 480 | The screen resolution is xxldpi.| | SCREEN_DENSITY_XXLDPI | 480 | The screen resolution is xxldpi.|
| SCREEN_DENSITY_XXXLDPI<sup>9+</sup> | 640 | The screen resolution is xxxldpi.| | SCREEN_DENSITY_XXXLDPI | 640 | The screen resolution is xxxldpi.|
# ExtensionContext # ExtensionContext
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Implements the extension context. This module is inherited from **Context**. Implements the extension context. This module is inherited from **Context**.
...@@ -14,3 +14,4 @@ Implements the extension context. This module is inherited from **Context**. ...@@ -14,3 +14,4 @@ Implements the extension context. This module is inherited from **Context**.
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP. | | currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP. |
| config | Configuration | Yes| No| Module configuration information.|
# ExtensionRunningInfo # ExtensionRunningInfo
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides extension running information. Provides extension running information.
......
# FormExtensionContext # FormExtensionContext
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Implements the context that provides the capabilities and APIs of **FormExtension**. This class is inherited from **ExtensionContext**. Implements the context that provides the capabilities and APIs of **FormExtension**. This class is inherited from **ExtensionContext**.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册