提交 a515c325 编写于 作者: W wusongqing

updated docs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 1632d97f
# AbilityStage
> **NOTE**<br>
> **NOTE**<br/>
> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -45,15 +45,15 @@ Called when a specified ability is started.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes | Information about the ability to start, such as the ability name and bundle name. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, such as the ability name and bundle name.|
**Return value**
| Type | Description |
| -------- | -------- |
| string | Returns an ability ID. If this ability has been started, no new instance is created and the ability is placed at the top of the stack. Otherwise, a new instance is created and started. |
| Type| Description|
| -------- | -------- |
| string | Returns an ability ID. If this ability has been started, no new instance is created and the ability is placed at the top of the stack. Otherwise, a new instance is created and started.|
**Example**
......@@ -77,9 +77,9 @@ Called when the global configuration is updated.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | Yes | Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode. |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| config | [Configuration](js-apis-configuration.md) | Yes| Callback invoked when the global configuration is updated. The global configuration indicates the configuration of the environment where the application is running and includes the language and color mode.|
**Example**
......@@ -92,10 +92,12 @@ Called when the global configuration is updated.
```
## AbilityStage.context
context: AbilityStageContext;
Describes the configuration information about the context.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Description |
| ----------- | --------------------------- | ------------------------------------------------------------ |
| context | [AbilityStageContext](js-apis-featureAbility.md) | Called when initialization is performed during ability startup. |
| Name | Type | Description |
| ----------- | --------------------------- | ------------------------------------------------------------ |
| context | [AbilityStageContext](js-apis-featureAbility.md) | Called when initialization is performed during ability startup.|
......@@ -6,6 +6,11 @@
Provides application-level context and APIs for registering and deregistering the ability lifecycle listener in an application.
## Modules to Import
```
import Ability from '@ohos.application.Ability';
```
## How to Use
......
......@@ -3,19 +3,18 @@
> **NOTE**<br/>
> 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.
```js
import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility';
```
Implements the extension context. This module is inherited from **Context**.
## Modules to Import
```js
import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility';
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| 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.|
# FeatureAbility Module (JavaScript)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> **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.
## Constraints
......@@ -44,7 +44,7 @@ featureAbility.startAbility(
deviceId: "",
bundleName: "com.example.myapplication",
/* In the FA model, abilityName consists of package and ability name. */
abilityName: "com.example.entry.secondAbility",,
abilityName: "com.example.entry.secondAbility",
uri: ""
},
},
......@@ -139,7 +139,7 @@ Starts an ability. This API uses a callback to return the execution result when
**Example**
```javascript
import featureAbility from '@ohos.ability.featureability';
import featureAbility from '@ohos.ability.featureAbility';
import wantConstant from '@ohos.ability.wantConstant'
featureAbility.startAbilityForResult(
{
......@@ -157,7 +157,7 @@ featureAbility.startAbilityForResult(
},
},
(err, data) => {
console.info("err: " + JSON.stringfy(err) + "data: " + JSON.stringfy(data))
console.info("err: " + JSON.stringify(err) + "data: " + JSON.stringify(data))
}
)
```
......@@ -185,7 +185,7 @@ Starts an ability. This API uses a promise to return the execution result when t
**Example**
```javascript
import featureAbility from '@ohos.ability.featureability';
import featureAbility from '@ohos.ability.featureAbility';
import wantConstant from '@ohos.ability.wantConstant'
featureAbility.startAbilityForResult(
{
......@@ -291,7 +291,7 @@ Destroys this Page ability, with the result code and data sent to the caller. Th
**Example**
```javascript
import featureAbility from '@ohos.ability.featureability';
import featureAbility from '@ohos.ability.featureAbility';
import wantConstant from '@ohos.ability.wantConstant'
featureAbility.terminateSelfWithResult(
{
......@@ -343,7 +343,7 @@ Checks whether the main window of this ability has the focus. This API uses a ca
**Example**
```javascript
import featureAbility from '@ohos.ability.featureability';
import featureAbility from '@ohos.ability.featureAbility';
featureAbility.hasWindowFocus()
```
......@@ -391,7 +391,7 @@ Obtains the **Want** object sent from this ability. This API uses a callback to
**Example**
```javascript
import featureAbility from '@ohos.ability.featureability';
import featureAbility from '@ohos.ability.featureAbility';
featureAbility.getWant()
```
......@@ -414,7 +414,7 @@ Obtains the **Want** object sent from this ability. This API uses a promise to r
**Example**
```javascript
import featureAbility from '@ohos.ability.featureability';
import featureAbility from '@ohos.ability.featureAbility';
featureAbility.getWant().then((data) => {
console.info("==========================>getWantCallBack=======================>");
});
......@@ -437,7 +437,7 @@ Obtains the application context.
**Example**
```javascript
import featureAbility from '@ohos.ability.featureability';
import featureAbility from '@ohos.ability.featureAbility';
var context = featureAbility.getContext()
context.getBundleName()
```
......@@ -461,7 +461,7 @@ Destroys this Page ability, with the result code and data sent to the caller. Th
**Example**
```javascript
import featureAbility from '@ohos.ability.featureability';
import featureAbility from '@ohos.ability.featureAbility';
featureAbility.terminateSelf()
```
......@@ -484,7 +484,7 @@ Destroys this Page ability, with the result code and data sent to the caller. Th
**Example**
```javascript
import featureAbility from '@ohos.ability.featureability';
import featureAbility from '@ohos.ability.featureAbility';
featureAbility.terminateSelf().then((data) => {
console.info("==========================>terminateSelfCallBack=======================>");
});
......@@ -918,7 +918,6 @@ Enumerates operation types of the Data ability.
| ------------------- | ---- | -------------------- | ---- | -------------------------------------- |
| want | Read-only | [Want](js-apis-application-Want.md) | Yes | Information about the ability to start. |
| abilityStartSetting | Read-only | {[key: string]: any} | No | Special attribute of the ability to start. This attribute can be passed in the method call.|
|
## flags
......
......@@ -3,7 +3,6 @@
> **NOTE**<br>
> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Provides the permission request result.
## Modules to Import
......@@ -12,6 +11,29 @@ Provides the permission request result.
import Ability from '@ohos.application.Ability'
```
## How to Use
The permission request result is obtained through an **AbilityStage** instance.
```js
import Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage) {
var permissions=['com.example.permission']
var permissionRequestResult;
this.context.requestPermissionsFromUser(permissions,(err,result) => {
if(err){
console.log('requestPermissionsFromUserError: ' + JSON.stringify(err));
}else{
permissionRequestResult=result;
console.log('permissionRequestResult: ' + JSON.stringify(permissionRequestResult));
}
});
}
}
```
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册