提交 d8367186 编写于 作者: 马靖涛 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into master

# Sensor Development
## When to Use
- Data provided by the compass sensor denotes the current orientation of the user device, which helps your application accurately navigate for the user.
- Data provided by the proximity sensor denotes the distance between the device and a visible object, which enables the device to automatically turn on or off its screen accordingly to prevent accidental touch on the screen.
- Data provided by the barometer sensor helps your application accurately determine the altitude of the device.
- Data provided by the ambient light sensor helps your device automatically adjust its backlight.
- Data provided by the Hall effect sensor implements the smart cover mode of your device.
- Data provided by the heart rate sensor helps your application track the health of a user.
- Data provided by the pedometer sensor helps your application obtain the number steps a user has walked.
- Data provided by the wear detection sensor helps your application detect whether a user is wearing a wearable device.
## Available APIs
| Module | API | Description |
| -------- | -------- | -------- |
| ohos.sensor | sensor.on(sensorType,callback:AsyncCallback<Response>):void | Subscribes to data changes of a type of sensor. |
| ohos.sensor | sensor.once(sensorType,callback:AsyncCallback<Response>):void | Subscribes to only one data change of a type of sensor. |
| ohos.sensor | sensor.off(sensorType,callback:AsyncCallback<void>):void | Unsubscribes from sensor data changes. |
## How to Develop
1. To obtain data from a type of sensor, configure the request permissions in the **config.json** file.
```
"reqPermissions":[
{
"name":"ohos.permission.ACCELEROMETER",
"reason"":"",
"usedScene":{
"ability": ["sensor.index.MainAbility",".MainAbility"],
"when":"inuse"
}
},
{
"name":"ohos.permission.GYROSCOPE",
"reason"":"",
"usedScene":{
"ability": ["sensor.index.MainAbility",".MainAbility"],
"when":"inuse"
}
},
{
"name":"ohos.permission.ACTIVITY_MOTION",
"reason"":"ACTIVITY_MOTION_TEST",
"usedScene":{
"ability": ["sensor.index.MainAbility",".MainAbility"],
"when":"inuse"
}
},
{
"name":"ohos.permission.READ_HEALTH_DATA",
"reason"":"HEALTH_DATA_TEST",
"usedScene":{
"ability": ["sensor.index.MainAbility",".MainAbility"],
"when":"inuse"
}
},
{
"name":"ohos.permission.VIBRATE",
"reason"":"",
"usedScene":{
"ability": [".MainAbility"],
"when":"inuse"
}
},
]
```
2. Subscribe to data changes of a type of sensor.
```
import sensor from "@ohos.sensor"
sensor.on(type:sensorType,function(error,data){
if (error) {// The call fails, and error.code and error.message are printed.
console.error("Subscription failed. Error code: " + error.code + "; message: " + error.message);
return;
};
console.info("Subscription succeeded. data = "+ data);// The call is successful, and the obtained sensor data is printed.
}
);
```
The following figure shows the successful call result when **SensorType** is **SENSOR_TYPE_ID_ACCELEROMETER**.
![en-us_image_0000001241693881](figures/en-us_image_0000001241693881.png)
3. Unsubscribe from sensor data changes.
```
import sensor from "@ohos.sensor"
sensor.off(type:sensorType,function(error) {
if (error) {// The unsubscription fails, and error.code and error.message are printed.
console.error("Failed to unsubscribe from acceleration sensor data. Error code: " + error.code + "; message: " + error.message);
return;
};
console.info("Succeeded in unsubscribing from acceleration sensor data.");// The unsubscription is successful, and the result is printed.
}
);
```
The following figure shows the successful call result when **SensorType** is **SENSOR_TYPE_ID_ACCELEROMETER**.
![en-us_image_0000001196654004](figures/en-us_image_0000001196654004.png)
4. Subscribe to only one data change of a type of sensor.
```
import sensor from "@ohos.sensor"
sensor.once(tyep:sensorType,function(error, data) {
if (error) {// The call fails, and error.code and error.message are printed.
console.error("Failed to obtain data. Error code: " + error.code + "; message: " + error.message);
return;
};
console.info("Data obtained successfully. data="+data);// The call is successful, and the obtained sensor data is printed.
}
);
```
The following figure shows the successful call result when **SensorType** is **SENSOR_TYPE_ID_ACCELEROMETER**.
![en-us_image_0000001241733907](figures/en-us_image_0000001241733907.png)
# Sensor Overview
Sensors in OpenHarmony are an abstraction of underlying hardware-based sensors. Your application can access the underlying sensors via OpenHarmony sensors. Using the APIs provided by OpenHarmony sensors, you can query sensors on your device, subscribe to sensor data, customize algorithms based on sensor data, and develop various sensor-based applications, such as compass, fitness and health, and games applications.
The sensors are classified into the following categories based on their functions: motion, environment, orientation, light, body, and other categories (such as Hall effect sensors). Each category includes different sensor types. A sensor type may be a single physical sensor or a composite of multiple physical sensors.
**Table1** Motion - ohos.sensor.agent.CategoryMotionAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_ACCELEROMETER | Acceleration sensor | Measures the acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Detecting the motion status |
| SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED | Uncalibrated acceleration sensor | Measures the uncalibrated acceleration (including the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Measuring the acceleration bias estimation |
| SENSOR_TYPE_LINEAR_ACCELERATION | Linear acceleration sensor | Measures the linear acceleration (excluding the gravity acceleration) applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Detecting the linear acceleration in each axis |
| SENSOR_TYPE_GRAVITY | Gravity sensor | Measures the gravity acceleration applied to a device on three physical axes (X, Y, and Z), in the unit of m/s<sup>2</sup>. | Measuring the gravity |
| SENSOR_TYPE_GYROSCOPE | Gyroscope sensor | Measures the rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s. | Measuring the rotation angular velocity |
| SENSOR_TYPE_GYROSCOPE_UNCALIBRATED | Uncalibrated gyroscope sensor | Measures the uncalibrated rotation angular velocity of a device on three physical axes (X, Y, and Z), in the unit of rad/s. | Measuring the bias estimation of the rotation angular velocity |
| SENSOR_TYPE_SIGNIFICANT_MOTION | Significant motion sensor | Checks whether a device has a significant motion on three physical axes (X, Y, and Z). The value can be **0** (having no significant motion) or **1** (having a significant motion). | Detecting significant motions of a device |
| SENSOR_TYPE_DROP_DETECTION | Drop detection sensor | Detects the device drop status. The value can be **0** (the device is not dropped) or **1** (the device is dropped). | Detecting whether a device is dropped |
| SENSOR_TYPE_PEDOMETER_DETECTION | Pedometer detection sensor | Detects whether a user takes a step. The value can be **0** (the user does not take a step) or **1** (the user takes a step). | Detecting whether a user takes a step |
| SENSOR_TYPE_PEDOMETER | Pedometer sensor | Records the number of steps a user has walked. | Providing the number of steps a user has walked |
**Table2** Environment - ohos.sensor.agent.CategoryOrientationAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_AMBIENT_TEMPERATURE | Ambient temperature sensor. | Measures the ambient temperature, in the unit of degree Celsius (°C). | Measuring the ambient temperature |
| SENSOR_TYPE_MAGNETIC_FIELD | Magnetic field sensor | Measures the magnetic field on three physical axes (X, Y, and Z), in the unit of μT. | Creating a compass |
| SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED | Uncalibrated magnetic field sensor | Measures the uncalibrated magnetic field on three physical axes (X, Y, and Z), in the unit of μT. | Measuring the magnetic field bias estimation |
| SENSOR_TYPE_HUMIDITY | Humidity sensor | Measures the ambient relative humidity, in a percentage (%). | Monitoring the dew point, absolute humidity, and relative humidity |
| SENSOR_TYPE_BAROMETER | Barometer sensor | Measures the barometric pressure, in the unit of hPa or mbar. | Measuring the barometric pressure |
| SENSOR_TYPE_SAR | Specific Absorption Rate (SAR) sensor | Measures the SAR, in the unit of W/kg. | Measuring the SAR of electromagnetic waves for a device |
**Table3** Orientation - ohos.sensor.agent.CategoryOrientationAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_6DOF | Degrees of Freedom (DoF) sensor | Measures the forward/backward, up/down, and left/right translational movement of a device on the three axes (X, Y, and Z) in the unit of m or mm as well as the roll, pitch, and yaw rotation angles on the three axes (X, Y, and Z) in the unit of rad. | Positioning an object by detecting its freedom of translational and rotational motions, for example, VR |
| SENSOR_TYPE_SCREEN_ROTATION | Screen rotation sensor | Checks the rotation status of the device screen. | Detecting whether the device screen is rotating |
| SENSOR_TYPE_DEVICE_ORIENTATION | Device orientation sensor | Measures the rotation angles of the device, in the unit of rad. | Measuring the angles that a device has rotated |
| SENSOR_TYPE_ORIENTATION | Orientation sensor | Measures the rotation angles of a device on three physical axes (X, Y, and Z), in the unit of rad. | Providing the three orientation angles of the screen |
| SENSOR_TYPE_ROTATION_VECTOR | Rotation vector sensor | Measures the rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor, magnetic field sensor, and gyroscope sensor. | Detecting the orientation of a device in the East, North, Up (ENU) Cartesian coordinate system |
| SENSOR_TYPE_GAME_ROTATION_VECTOR<br/>SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR | Game rotation vector sensor<br/>Geomagnetic rotation vector sensor | Measures the game rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor and gyroscope sensor.<br/>Measures the geomagnetic rotation vector of a device. It is a composite sensor that generates data from the acceleration sensor and magnetic field sensor. | Applied in games<br/>Measuring the geomagnetic rotation vector |
**Table4** Light - ohos.sensor.agent.CategoryLightAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_PROXIMITY | Proximity sensor | Measures the distance between a visible object and the device screen. | Measuring the distance between a person and the device during a call |
| SENSOR_TYPE_TOF | Time of flight (ToF) sensor | Measures the time required for light to travel a distance in the medium. | Facial recognition |
| SENSOR_TYPE_AMBIENT_LIGHT | Ambient light sensor | Measures the ambient light intensity of a device, in the unit of lux. | Automatically adjusting the screen brightness and checking whether the screen is covered on the top |
| SENSOR_TYPE_COLOR_TEMPERATURE | Color temperature sensor | Measures the ambient color temperature. | Image processing on the device |
| SENSOR_TYPE_COLOR_RGB | RGB color sensor | Measures the ambient RGB color values. | Color detection implemented by the reflectance of RGB colors |
| SENSOR_TYPE_COLOR_XYZ | XYZ color sensor | Measures the ambient XYZ color values. | Identifying true-color spots to reproduce more natural colors |
**Table5** Body - ohos.sensor.agent.CategoryBodyAgent
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_HEART_RATE | Heart rate sensor | Measures the heart rate of a user. | Providing users' heart rate data |
| SENSOR_TYPE_WEAR_DETECTION | Wear detection sensor | Checks whether a user is wearing a wearable device. | Detecting wearables |
**Table6** Others
| Sensor Type | Sensor Name | Description | Usage |
| -------- | -------- | -------- | -------- |
| SENSOR_TYPE_HALL | Hall effect sensor | Detects a magnetic field around a device. | Smart cover mode of the device |
| SENSOR_TYPE_GRIP_DETECTOR | Grip detection sensor | Detects grip force applied on a device. | Detecting whether the device is gripped on its sides |
| SENSOR_TYPE_MAGNET_BRACKET | Magnet bracket sensor | Checks whether a device is magnetized. | Detecting an in-vehicle or indoor device |
| SENSOR_TYPE_PRESSURE_DETECTOR | Pressure detection sensor | Detects pressure force applied on a device. | Detecting pressure on the top of the device |
## How a Service Is Shared Using Huawei Share
The following modules work cooperatively to implement OpenHarmony sensors: Sensor API, Sensor Framework, Sensor Service, and HD_IDL.
**Figure1** Working principles for OpenHarmony sensors
![en-us_image_0000001226521897](figures/en-us_image_0000001226521897.png)
- Sensor API: provides APIs for performing basic operations on sensors, including querying the sensor list, subscribing to or unsubscribing from sensor data, and executing control commands. This module makes application development simpler.
- Sensor Framework: manages sensor data subscription, creates and destroys data channels, subscribes to or unsubscribes from sensor data, and implements communication with the Sensor Service module.
- Sensor Service: interacts with the HD_IDL module to receive, parse, and distribute data, manages foreground and background policies and sensors of a device, and controls sensor permissions.
- HD_IDL: selects proper policies based on the hardware first in first out (FIFO) and frequency, and adapts to different devices.
## Limitations and Constraints
To obtain data of the following sensors, you must claim the required permissions.
**Table7** Sensor data permission
| Sensor | Permission Name | Sensitivity | Permission Description |
| -------- | -------- | -------- | -------- |
| Acceleration sensor, uncalibrated acceleration sensor, and linear acceleration sensor | ohos.permission.ACCELEROMETER | system_grant | Allows your application to subscribe to data of these acceleration-related sensors in the motion category. |
| Gyroscope sensor and uncalibrated gyroscope sensor | ohos.permission.GYROSCOPE | system_grant | Allows your application to subscribe to data of these gyroscope-related sensors in the motion category. |
| Pedometer sensor | ohos.permission.ACTIVITY_MOTION | user_grant | Allows your application to subscribe to the motion status. |
| Heart rate sensor | ohos.permission.READ_HEALTH_DATA | user_grant | Allows your application to read health data. |
The APIs for subscribing to and unsubscribing from sensor data work in pairs. If you do not need sensor data, call the unsubscription API to stop sensor data reporting.
# Combination Key
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - 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 APIs of this module are system APIs and cannot be called by third-party applications.
## Modules to Import
```
import inputConsumer from '@ohos.multimodalInput.inputConsumer';
```
## inputConsumer.on
on(type: "key", keyOption: KeyOption, callback: Callback&lt;KeyOption&gt;): void
Enables listening for combination key events. When a combination key event that meets the specified conditions occurs, **keyOption** will be passed as an input parameter to **callback**.
**System capability**: SystemCapability.MultimodalInput.Input.InputConsumer
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type of the key input event to listen for. Only **key** is supported. |
| keyOption | [KeyOption](#keyoption) | Yes | Key option, which specifies the condition for combination key input. |
| callback | Callback&lt;KeyOption&gt; | Yes | Callback function. When a key input event that meets the specified options occurs, **keyOption** will be passed as an input parameter to **callback**. |
**Example**
```
let keyOption = {preKeys: [], finalKey: 3, isFinalKeyDown: true, finalKeyDownDuration: 0}
let callback = function(keyOption) {
console.info("preKeys: " + keyOption.preKeys, "finalKey: " + keyOption.finalKey,
"isFinalKeyDown: " + keyOption.isFinalKeyDown, "finalKeyDownDuration: " + keyOption.finalKeyDownDuration)
}
inputConsumer.on('key', keyOption, callback);
```
## inputConsumer.off
off(type: "key", keyOption: KeyOption, callback: Callback&lt;KeyOption&gt;): void
Stops listening for combination key events.
**System capability**: SystemCapability.MultimodalInput.Input.InputConsumer
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type of the key input event to listen for. Only **key** is supported. |
| keyOption | [KeyOption](#keyoption) | Yes | Key option passed to the key input event when listening starts. |
| callback | Callback&lt;KeyOption&gt; | Yes | Callback function passed to the key input event with the key option when listening starts. |
**Example**
```
let keyOption = {preKeys: [], finalKey: 3, isFinalKeyDown: true, finalKeyDownDuration: 0}
let callback = function(keyOption) {
console.info("preKeys: " + keyOption.preKeys, "finalKey: " + keyOption.finalKey,
"isFinalKeyDown: " + keyOption.isFinalKeyDown, "finalKeyDownDuration: " + keyOption.finalKeyDownDuration)
}
inputConsumer.off('key', keyOption, callback);
```
## KeyOption
Defines the key options that are met when a combination key input event occurs.
**System capability**: SystemCapability.MultimodalInput.Input.InputConsumer
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| preKeys | Array | Yes | Array of precedent keys. This parameter can be left empty. There is no requirement on the sequence of precedent keys. |
| finalKey | Number | Yes | Final key in the combination key. This parameter cannot be left blank. |
| isFinalKeyDown | boolean | Yes | Indicates whether the final key is pressed or released. By default, the final key is pressed. |
| finalKeyDownDuration | Number | Yes | Duration for pressing the final key. By default, there is no requirement on the duration. |
# Input Device
The input device management module is used to listen for the connection, disconnection, and updates of input devices and display information about input devices. For example, it can be used to listen for mouse insertion and removal and obtain information such as the ID, name, and pointer speed of the mouse.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> 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.
## Modules to Import
```
import inputDevice from '@ohos.multimodalInput.inputDevice';
```
## inputDevice.getDeviceIds
getDeviceIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void
Obtains the IDs of all input devices. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.InputDevice
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | Yes | Callback used to return the result. |
**Example**
```
data: {
deviceIds: Array,
},
callback: function(ids) {
this.deviceIds = ids;
},
testGetDeviceIds: function () {
console.info("InputDeviceJsTest---start---testGetDeviceIds");
inputDevice.getDeviceIds(this.callback);
console.info("InputDeviceJsTest---end---testGetDeviceIds");
}
```
## inputDevice.getDevice
getDevice(deviceId: number, callback: AsyncCallback&lt;InputDeviceData&gt;): void
Obtains the information about an input device. This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.MultimodalInput.Input.InputDevice
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| deviceId | number | Yes | ID of the input device whose information is to be obtained. |
| callback | AsyncCallback&lt;[InputDeviceData](#inputdevicedata)&gt; | Yes | Callback used to return the **InputDeviceData** object. |
**Example**
```
InputDeviceData {
deviceId : 0,
name : "NA",
sources : Array,
axisRanges : Array,
},
callback: function(deviceData) {
this.InputDeviceData = deviceData;
},
testGetDevice: function () {
// The example is used to obtain the information about the device whose ID is 1.
console.info("InputDeviceJsTest---start---testGetDevice");
inputDevice.getDevice(1, this.callback);
console.info("InputDeviceJsTest---end---testGetDevice");
}
```
## InputDeviceData
Defines the information about an input device.
**System capability**: SystemCapability.MultimodalInput.Input.InputDevice
| Name | Type | Description |
| -------- | -------- | -------- |
| id | number | Unique identifier of an input device. If the same physical device is repeatedly inserted and removed, its ID changes. |
| name | string | Name of the input device. |
| sources | Array&lt;[SourceType](#sourcetype)&gt; | Source types of the input device. For example, if a keyboard is attached with a touchpad, the device has two input sources: keyboard and touchpad. |
## SourceType
Enumerates the input source types.
**System capability**: SystemCapability.MultimodalInput.Input.InputDevice
| Name | Type | Description |
| -------- | -------- | -------- |
| keyboard | string | The input device is a keyboard. |
| touchscreen | string | The input device is a touchscreen. |
| mouse | string | The input device is a mouse. |
| trackball | string | The input device is a trackball. |
| touchpad | string | The input device is a touchpad. |
| joystick | string | The input device is a joystick. |
# Input Monitor
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs of this module are system APIs and cannot be called by third-party applications.
## Modules to Import
```
import inputMonitor from '@ohos.multimodalInput.inputMonitor';
```
## Required Permissions
ohos.permission.INPUT_MONITORING
## inputMonitor.on
on(type: "touch", receiver: TouchEventReceiver): void
Starts listening for global input events.
**Required permissions**: ohos.permission.INPUT_MONITORING
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
**Parameters**
| Parameter | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type&nbsp;of&nbsp;the&nbsp;input&nbsp;event.&nbsp;Currently,&nbsp;only&nbsp;**touch**&nbsp;events&nbsp;are&nbsp;supported. |
| receiver | [TouchEventReceiver](#toucheventreceiver) | Yes | Callback&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;touch&nbsp;event. |
**Example**
```
callback: function (value) {
if (checkEvent(value)) {
// The event meets the service requirement and is consumed.
return true;
} else {
// The event does not meet the service requirement and is not consumed.
return false;
}
},
testOn: function () {
console.info("InputMonitorJsTest---start---testOn");
inputMonitor.on(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOn");
}
```
## inputMonitor.off
off(type: "touch", receiver: TouchEventReceiver): void
Stops listening for global input events.
**Required permissions**: ohos.permission.INPUT_MONITORING
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
**Parameters**
| Parameter | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| type | string | Yes | Type&nbsp;of&nbsp;the&nbsp;input&nbsp;event.&nbsp;Currently,&nbsp;only&nbsp;**touch**&nbsp;events&nbsp;are&nbsp;supported. |
| receiver | [TouchEventReceiver](#toucheventreceiver) | No | Callback&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;touch&nbsp;event. |
**Example**
```
callback: function (value) {
if (checkEvent(value)) {
// The event meets the service requirement and is consumed.
return true;
} else {
// The event does not meet the service requirement and is not consumed.
return false;
}
},
testOff: function () {
console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOff");
}
```
## TouchEventReceiver
Represents the class of the callback used to return the touch event. The value **true** indicates that the touch event has been consumed, and the value **false** indicates the opposite.
### (touchEvent: TouchEvent): Boolean
Represents the callback used to return the touch event. You need to define the name of the callback function in the correct format. Ensure that the input parameter is of the **TouchEvent** type, and the return value is of the **Boolean** type.
**System capability**: SystemCapability.MultimodalInput.Input.InputMonitor
**Parameters**
| Parameter | Type | Mandatory | Description |
| -------- | -------- | -------- | -------- |
| touchEvent | [TouchEvent](../arkui-js/js-components-common-events.md) | Yes | Callback&nbsp;used&nbsp;to&nbsp;return&nbsp;the&nbsp;touch&nbsp;event. |
**Return value**
| Type | Description |
| -------- | -------- |
| Boolean | Result&nbsp;indicating&nbsp;whether&nbsp;the&nbsp;touch&nbsp;event&nbsp;has&nbsp;been&nbsp;consumed&nbsp;by&nbsp;the&nbsp;input&nbsp;monitor.&nbsp;The&nbsp;value&nbsp;**true**&nbsp;indicates&nbsp;that&nbsp;the&nbsp;touch&nbsp;event&nbsp;has&nbsp;been&nbsp;consumed,&nbsp;and&nbsp;the&nbsp;value&nbsp;**false**&nbsp;indicates&nbsp;the&nbsp;opposite. |
**Example**
```
callback: function (value) {// Implementation of the (touchEvent:TouchEvent): Boolean API.
if (checkEvent(value)) {
// The event meets the service requirement and is consumed.
return true;
} else {
// The event does not meet the service requirement and is not consumed.
return false;
}
},
testOff: function () {
console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOff");
}
```
...@@ -114,7 +114,7 @@ child.getErrorOutput.then(val=>{ ...@@ -114,7 +114,7 @@ child.getErrorOutput.then(val=>{
### close ### close
close(): void close(): void
Closes the child process in running. Closes the child process in running.
...@@ -167,7 +167,7 @@ var result = process.isIsolatedProcess(); ...@@ -167,7 +167,7 @@ var result = process.isIsolatedProcess();
## process.isAppUid<sup>8+</sup> ## process.isAppUid<sup>8+</sup>
isAppUid(v:number): boolean isAppUid(v: number): boolean
Checks whether a UID belongs to this app. Checks whether a UID belongs to this app.
...@@ -211,7 +211,7 @@ var ressult = process.is64Bit(); ...@@ -211,7 +211,7 @@ var ressult = process.is64Bit();
## process.getUidForName<sup>8+</sup> ## process.getUidForName<sup>8+</sup>
getUidForName(v:string): number getUidForName(v: string): number
Obtains the process UID based on the process name. Obtains the process UID based on the process name.
...@@ -236,7 +236,7 @@ var pres = process.getUidForName("tool") ...@@ -236,7 +236,7 @@ var pres = process.getUidForName("tool")
## process.getThreadPriority<sup>8+</sup> ## process.getThreadPriority<sup>8+</sup>
getThreadPriority(v:number): number getThreadPriority(v: number): number
Obtains the thread priority based on the specified TID. Obtains the thread priority based on the specified TID.
...@@ -278,9 +278,9 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti ...@@ -278,9 +278,9 @@ Obtains the duration, in milliseconds, from the time the system starts to the ti
var realtime = process.getStartRealtime(); var realtime = process.getStartRealtime();
``` ```
## process.getPastCputime<sup>8+</sup> ## process.getPastCpuTime<sup>8+</sup>
getPastCputime(): number getPastCpuTime(): number
Obtains the CPU time (in milliseconds) from the time the process starts to the current time. Obtains the CPU time (in milliseconds) from the time the process starts to the current time.
...@@ -293,13 +293,13 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c ...@@ -293,13 +293,13 @@ Obtains the CPU time (in milliseconds) from the time the process starts to the c
**Example** **Example**
``` ```
var result = process.getPastCputime() ; var result = process.getPastCpuTime() ;
``` ```
## process.getSystemConfig<sup>8+</sup> ## process.getSystemConfig<sup>8+</sup>
getSystemConfig(name:number): number getSystemConfig(name: number): number
Obtains the system configuration. Obtains the system configuration.
...@@ -325,7 +325,7 @@ var pres = process.getSystemConfig(_SC_ARG_MAX) ...@@ -325,7 +325,7 @@ var pres = process.getSystemConfig(_SC_ARG_MAX)
## process.getEnvironmentVar<sup>8+</sup> ## process.getEnvironmentVar<sup>8+</sup>
getEnvironmentVar(name:string): string getEnvironmentVar(name: string): string
Obtains the value of an environment variable. Obtains the value of an environment variable.
...@@ -416,7 +416,7 @@ Stores the events triggered by the user. ...@@ -416,7 +416,7 @@ Stores the events triggered by the user.
| Name| Description| | Name| Description|
| -------- | -------- | | -------- | -------- |
| EventListener&nbsp;=&nbsp;(evt:&nbsp;Object)&nbsp;=&gt;&nbsp;void | Event to store.| | EventListener&nbsp;=&nbsp;(evt: &nbsp;Object)&nbsp;=&gt;&nbsp;void | Event to store.|
**Example** **Example**
...@@ -527,7 +527,7 @@ var time = process.uptime(); ...@@ -527,7 +527,7 @@ var time = process.uptime();
## process.kill ## process.kill
kill(pid: number, signal: number): boolean kill(pid: number, signal: number ): boolean
Sends a signal to the specified process to terminate it. Sends a signal to the specified process to terminate it.
......
...@@ -147,7 +147,7 @@ Processes an asynchronous function and returns a promise version. ...@@ -147,7 +147,7 @@ Processes an asynchronous function and returns a promise version.
### constructor ### constructor
constructor(encoding?:string, options?:{ fatal?:boolean;ignoreBOM?:boolean }) constructor(encoding?: string, options?: { fatal?: boolean;ignoreBOM?: boolean })
A constructor used to create a **TextDecoder** object. A constructor used to create a **TextDecoder** object.
...@@ -168,13 +168,13 @@ A constructor used to create a **TextDecoder** object. ...@@ -168,13 +168,13 @@ A constructor used to create a **TextDecoder** object.
**Example** **Example**
``` ```
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM:true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
``` ```
### decode ### decode
decode(input: Unit8Array, options?:{stream?:false}): string decode(input: Unit8Array, options?: {stream?: false}): string
Decodes the input content. Decodes the input content.
...@@ -199,7 +199,7 @@ Decodes the input content. ...@@ -199,7 +199,7 @@ Decodes the input content.
**Example** **Example**
``` ```
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM:true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
var result = new Uint8Array(6); var result = new Uint8Array(6);
result[0] = 0xEF; result[0] = 0xEF;
result[1] = 0xBB; result[1] = 0xBB;
...@@ -211,7 +211,7 @@ Decodes the input content. ...@@ -211,7 +211,7 @@ Decodes the input content.
for(var j= 0; j < 6; j++) { for(var j= 0; j < 6; j++) {
console.log(result[j]); console.log(result[j]);
} }
var retStr = textDecoder.decode( result , {stream:false}); var retStr = textDecoder.decode( result , {stream: false});
console.log("retStr = " + retStr); console.log("retStr = " + retStr);
``` ```
...@@ -243,7 +243,7 @@ A constructor used to create a **TextEncoder** object. ...@@ -243,7 +243,7 @@ A constructor used to create a **TextEncoder** object.
### encode ### encode
encode(input?:string):Uint8Array encode(input?: string): Uint8Array
Encodes the input content. Encodes the input content.
...@@ -269,7 +269,7 @@ Encodes the input content. ...@@ -269,7 +269,7 @@ Encodes the input content.
### encodeInto ### encodeInto
encodeInto(input:string, dest:Uint8Array, ):{ read:number; written:number } encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number }
Stores the UTF-8 encoded text. Stores the UTF-8 encoded text.
...@@ -299,7 +299,7 @@ Stores the UTF-8 encoded text. ...@@ -299,7 +299,7 @@ Stores the UTF-8 encoded text.
### constructor<sup>8+</sup> ### constructor<sup>8+</sup>
constructor(numerator:number,denominator:number) constructor(numerator: number,denominator: number)
A constructor used to create a **RationalNumber** object. A constructor used to create a **RationalNumber** object.
...@@ -319,7 +319,7 @@ A constructor used to create a **RationalNumber** object. ...@@ -319,7 +319,7 @@ A constructor used to create a **RationalNumber** object.
### createRationalFromString<sup>8+</sup> ### createRationalFromString<sup>8+</sup>
static createRationalFromString​(rationalString:string):RationalNumber​ static createRationalFromString​(rationalString: string): RationalNumber​
Creates a **RationalNumber** object based on the given string. Creates a **RationalNumber** object based on the given string.
...@@ -344,7 +344,7 @@ Creates a **RationalNumber** object based on the given string. ...@@ -344,7 +344,7 @@ Creates a **RationalNumber** object based on the given string.
### compareTo<sup>8+</sup> ### compareTo<sup>8+</sup>
compareTo​(another:RationalNumber):number​ compareTo​(another: RationalNumber): number​
Compares this **RationalNumber** object with a given object. Compares this **RationalNumber** object with a given object.
...@@ -370,7 +370,7 @@ Compares this **RationalNumber** object with a given object. ...@@ -370,7 +370,7 @@ Compares this **RationalNumber** object with a given object.
### valueOf<sup>8+</sup> ### valueOf<sup>8+</sup>
valueOf():number valueOf(): number
Obtains the value of this **RationalNumber** object as an integer or a floating-point number. Obtains the value of this **RationalNumber** object as an integer or a floating-point number.
...@@ -390,7 +390,7 @@ Obtains the value of this **RationalNumber** object as an integer or a floating- ...@@ -390,7 +390,7 @@ Obtains the value of this **RationalNumber** object as an integer or a floating-
### equals<sup>8+</sup> ### equals<sup>8+</sup>
equals​(obj:Object):boolean equals​(obj: Object): boolean
Checks whether this **RationalNumber** object equals the given object. Checks whether this **RationalNumber** object equals the given object.
...@@ -416,7 +416,7 @@ Checks whether this **RationalNumber** object equals the given object. ...@@ -416,7 +416,7 @@ Checks whether this **RationalNumber** object equals the given object.
### getCommonDivisor<sup>8+</sup> ### getCommonDivisor<sup>8+</sup>
static getCommonDivisor​(number1:number,number2:number):number static getCommonDivisor​(number1: number,number2: number): number
Obtains the greatest common divisor of two specified integers. Obtains the greatest common divisor of two specified integers.
...@@ -442,7 +442,7 @@ Obtains the greatest common divisor of two specified integers. ...@@ -442,7 +442,7 @@ Obtains the greatest common divisor of two specified integers.
### getNumerator<sup>8+</sup> ### getNumerator<sup>8+</sup>
getNumerator​():number getNumerator​(): number
Obtains the numerator of this **RationalNumber** object. Obtains the numerator of this **RationalNumber** object.
...@@ -463,7 +463,7 @@ Obtains the numerator of this **RationalNumber** object. ...@@ -463,7 +463,7 @@ Obtains the numerator of this **RationalNumber** object.
### getDenominator<sup>8+</sup> ### getDenominator<sup>8+</sup>
getDenominator​():number getDenominator​(): number
Obtains the denominator of this **RationalNumber** object. Obtains the denominator of this **RationalNumber** object.
...@@ -483,7 +483,7 @@ Obtains the denominator of this **RationalNumber** object. ...@@ -483,7 +483,7 @@ Obtains the denominator of this **RationalNumber** object.
### isZero<sup>8+</sup> ### isZero<sup>8+</sup>
isZero​():boolean isZero​(): boolean
Checks whether this **RationalNumber** object is **0**. Checks whether this **RationalNumber** object is **0**.
...@@ -503,7 +503,7 @@ Checks whether this **RationalNumber** object is **0**. ...@@ -503,7 +503,7 @@ Checks whether this **RationalNumber** object is **0**.
### isNaN<sup>8+</sup> ### isNaN<sup>8+</sup>
isNaN​():boolean isNaN​(): boolean
Checks whether this **RationalNumber** object is a Not a Number (NaN). Checks whether this **RationalNumber** object is a Not a Number (NaN).
...@@ -523,7 +523,7 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN). ...@@ -523,7 +523,7 @@ Checks whether this **RationalNumber** object is a Not a Number (NaN).
### isFinite<sup>8+</sup> ### isFinite<sup>8+</sup>
isFinite​():boolean isFinite​(): boolean
Checks whether this **RationalNumber** object represents a finite value. Checks whether this **RationalNumber** object represents a finite value.
...@@ -543,7 +543,7 @@ Checks whether this **RationalNumber** object represents a finite value. ...@@ -543,7 +543,7 @@ Checks whether this **RationalNumber** object represents a finite value.
### toString<sup>8+</sup> ### toString<sup>8+</sup>
toString​():string toString​(): string
Obtains the string representation of this **RationalNumber** object. Obtains the string representation of this **RationalNumber** object.
...@@ -581,7 +581,7 @@ Obtains the string representation of this **RationalNumber** object. ...@@ -581,7 +581,7 @@ Obtains the string representation of this **RationalNumber** object.
### constructor<sup>8+</sup> ### constructor<sup>8+</sup>
constructor(capacity?:number) constructor(capacity?: number)
A constructor used to create an **LruBuffer** instance. The default capacity of the buffer is 64. A constructor used to create an **LruBuffer** instance. The default capacity of the buffer is 64.
...@@ -600,7 +600,7 @@ A constructor used to create an **LruBuffer** instance. The default capacity of ...@@ -600,7 +600,7 @@ A constructor used to create an **LruBuffer** instance. The default capacity of
### updateCapacity<sup>8+</sup> ### updateCapacity<sup>8+</sup>
updateCapacity(newCapacity:number):void updateCapacity(newCapacity: number): void
Changes the **LruBuffer** capacity. If the new capacity is less than or equal to **0**, an exception will be thrown. Changes the **LruBuffer** capacity. If the new capacity is less than or equal to **0**, an exception will be thrown.
...@@ -620,7 +620,7 @@ Changes the **LruBuffer** capacity. If the new capacity is less than or equal to ...@@ -620,7 +620,7 @@ Changes the **LruBuffer** capacity. If the new capacity is less than or equal to
### toString<sup>8+</sup> ### toString<sup>8+</sup>
toString():string toString(): string
Obtains the string representation of this **LruBuffer** object. Obtains the string representation of this **LruBuffer** object.
...@@ -643,7 +643,7 @@ Obtains the string representation of this **LruBuffer** object. ...@@ -643,7 +643,7 @@ Obtains the string representation of this **LruBuffer** object.
### getCapacity<sup>8+</sup> ### getCapacity<sup>8+</sup>
getCapacity():number getCapacity(): number
Obtains the capacity of this buffer. Obtains the capacity of this buffer.
...@@ -663,7 +663,7 @@ Obtains the capacity of this buffer. ...@@ -663,7 +663,7 @@ Obtains the capacity of this buffer.
### clear<sup>8+</sup> ### clear<sup>8+</sup>
clear():void clear(): void
Clears key-value pairs from this buffer. The **afterRemoval()** method will be called to perform subsequent operations. Clears key-value pairs from this buffer. The **afterRemoval()** method will be called to perform subsequent operations.
...@@ -680,7 +680,7 @@ Clears key-value pairs from this buffer. The **afterRemoval()** method will be c ...@@ -680,7 +680,7 @@ Clears key-value pairs from this buffer. The **afterRemoval()** method will be c
### getCreateCount<sup>8+</sup> ### getCreateCount<sup>8+</sup>
getCreateCount():number getCreateCount(): number
Obtains the number of return values for **createDefault()**. Obtains the number of return values for **createDefault()**.
...@@ -701,7 +701,7 @@ Obtains the number of return values for **createDefault()**. ...@@ -701,7 +701,7 @@ Obtains the number of return values for **createDefault()**.
### getMissCount<sup>8+</sup> ### getMissCount<sup>8+</sup>
getMissCount():number getMissCount(): number
Obtains the number of times that the queried values are mismatched. Obtains the number of times that the queried values are mismatched.
...@@ -723,7 +723,7 @@ Obtains the number of times that the queried values are mismatched. ...@@ -723,7 +723,7 @@ Obtains the number of times that the queried values are mismatched.
### getRemovalCount<sup>8+</sup> ### getRemovalCount<sup>8+</sup>
getRemovalCount():number getRemovalCount(): number
Obtains the number of removals from this buffer. Obtains the number of removals from this buffer.
...@@ -746,7 +746,7 @@ Obtains the number of removals from this buffer. ...@@ -746,7 +746,7 @@ Obtains the number of removals from this buffer.
### getMatchCount<sup>8+</sup> ### getMatchCount<sup>8+</sup>
getMatchCount():number getMatchCount(): number
Obtains the number of times that the queried values are matched. Obtains the number of times that the queried values are matched.
...@@ -768,7 +768,7 @@ Obtains the number of times that the queried values are matched. ...@@ -768,7 +768,7 @@ Obtains the number of times that the queried values are matched.
### getPutCount<sup>8+</sup> ### getPutCount<sup>8+</sup>
getPutCount():number getPutCount(): number
Obtains the number of additions to this buffer. Obtains the number of additions to this buffer.
...@@ -789,7 +789,7 @@ Obtains the number of additions to this buffer. ...@@ -789,7 +789,7 @@ Obtains the number of additions to this buffer.
### isEmpty<sup>8+</sup> ### isEmpty<sup>8+</sup>
isEmpty():boolean isEmpty(): boolean
Checks whether this buffer is empty. Checks whether this buffer is empty.
...@@ -810,7 +810,7 @@ Checks whether this buffer is empty. ...@@ -810,7 +810,7 @@ Checks whether this buffer is empty.
### get<sup>8+</sup> ### get<sup>8+</sup>
get(key:K):V | undefined get(key: K): V | undefined
Obtains the value of the specified key. Obtains the value of the specified key.
...@@ -836,7 +836,7 @@ Obtains the value of the specified key. ...@@ -836,7 +836,7 @@ Obtains the value of the specified key.
### put<sup>8+</sup> ### put<sup>8+</sup>
put(key:K,value:V):V put(key: K,value: V): V
Adds a key-value pair to this buffer. Adds a key-value pair to this buffer.
...@@ -862,7 +862,7 @@ Adds a key-value pair to this buffer. ...@@ -862,7 +862,7 @@ Adds a key-value pair to this buffer.
### values<sup>8+</sup> ### values<sup>8+</sup>
values():V[] values(): V[]
Obtains all values in this buffer, listed from the most to the least recently accessed. Obtains all values in this buffer, listed from the most to the least recently accessed.
...@@ -885,7 +885,7 @@ Obtains all values in this buffer, listed from the most to the least recently ac ...@@ -885,7 +885,7 @@ Obtains all values in this buffer, listed from the most to the least recently ac
### keys<sup>8+</sup> ### keys<sup>8+</sup>
keys():K[] keys(): K[]
Obtains all keys in this buffer, listed from the most to the least recently accessed. Obtains all keys in this buffer, listed from the most to the least recently accessed.
...@@ -906,7 +906,7 @@ Obtains all keys in this buffer, listed from the most to the least recently acce ...@@ -906,7 +906,7 @@ Obtains all keys in this buffer, listed from the most to the least recently acce
### remove<sup>8+</sup> ### remove<sup>8+</sup>
remove(key:K):V | undefined remove(key: K): V | undefined
Removes the specified key and its value from this buffer. Removes the specified key and its value from this buffer.
...@@ -932,7 +932,7 @@ Removes the specified key and its value from this buffer. ...@@ -932,7 +932,7 @@ Removes the specified key and its value from this buffer.
### afterRemoval<sup>8+</sup> ### afterRemoval<sup>8+</sup>
afterRemoval(isEvict:boolean,key:K,value:V,newValue:V):void afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void
Performs subsequent operations after a value is removed. Performs subsequent operations after a value is removed.
...@@ -977,7 +977,7 @@ Performs subsequent operations after a value is removed. ...@@ -977,7 +977,7 @@ Performs subsequent operations after a value is removed.
### contains<sup>8+</sup> ### contains<sup>8+</sup>
contains(key:K):boolean contains(key: K): boolean
Checks whether this buffer contains the specified key. Checks whether this buffer contains the specified key.
...@@ -1003,7 +1003,7 @@ Checks whether this buffer contains the specified key. ...@@ -1003,7 +1003,7 @@ Checks whether this buffer contains the specified key.
### createDefault<sup>8+</sup> ### createDefault<sup>8+</sup>
createDefault(key:K):V createDefault(key: K): V
Creates a value if the value of the specified key is not available. Creates a value if the value of the specified key is not available.
...@@ -1028,7 +1028,7 @@ Creates a value if the value of the specified key is not available. ...@@ -1028,7 +1028,7 @@ Creates a value if the value of the specified key is not available.
### entries<sup>8+</sup> ### entries<sup>8+</sup>
entries():IterableIterator&lt;[K,V]&gt; entries(): IterableIterator&lt;[K,V]&gt;
Obtains a new iterator object that contains all key-value pairs in this object. Obtains a new iterator object that contains all key-value pairs in this object.
...@@ -1078,7 +1078,7 @@ Defines the type of values in a **Scope** object. The value type can be **ScopeC ...@@ -1078,7 +1078,7 @@ Defines the type of values in a **Scope** object. The value type can be **ScopeC
The values of the **ScopeComparable** type are used to implement the **compareTo** method. Therefore, ensure that the input parameters are comparable. The values of the **ScopeComparable** type are used to implement the **compareTo** method. Therefore, ensure that the input parameters are comparable.
``` ```
interface ScopeComparable{ interface ScopeComparable{
compareTo(other:ScopeComparable):boolean; compareTo(other: ScopeComparable): boolean;
} }
type ScopeType = ScopeComparable | number; type ScopeType = ScopeComparable | number;
``` ```
...@@ -1108,7 +1108,7 @@ class Temperature{ ...@@ -1108,7 +1108,7 @@ class Temperature{
### constructor<sup>8+</sup> ### constructor<sup>8+</sup>
constructor(lowerObj:ScopeType,upperObje:ScopeType) constructor(lowerObj: ScopeType,upperObje: ScopeType)
A constructor used to create a **Scope** object with the specified upper and lower limits. A constructor used to create a **Scope** object with the specified upper and lower limits.
...@@ -1130,7 +1130,7 @@ A constructor used to create a **Scope** object with the specified upper and low ...@@ -1130,7 +1130,7 @@ A constructor used to create a **Scope** object with the specified upper and low
### toString<sup>8+</sup> ### toString<sup>8+</sup>
toString():string toString(): string
Obtains a string representation that contains this **Scope**. Obtains a string representation that contains this **Scope**.
...@@ -1152,7 +1152,7 @@ Obtains a string representation that contains this **Scope**. ...@@ -1152,7 +1152,7 @@ Obtains a string representation that contains this **Scope**.
### intersect<sup>8+</sup> ### intersect<sup>8+</sup>
intersect(range:Scope):Scope intersect(range: Scope): Scope
Obtains the intersection of this **Scope** and the given **Scope**. Obtains the intersection of this **Scope** and the given **Scope**.
...@@ -1182,7 +1182,7 @@ Obtains the intersection of this **Scope** and the given **Scope**. ...@@ -1182,7 +1182,7 @@ Obtains the intersection of this **Scope** and the given **Scope**.
### intersect<sup>8+</sup> ### intersect<sup>8+</sup>
intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope intersect(lowerObj: ScopeType,upperObj: ScopeType): Scope
Obtains the intersection of this **Scope** and the given lower and upper limits. Obtains the intersection of this **Scope** and the given lower and upper limits.
...@@ -1212,7 +1212,7 @@ Obtains the intersection of this **Scope** and the given lower and upper limits. ...@@ -1212,7 +1212,7 @@ Obtains the intersection of this **Scope** and the given lower and upper limits.
### getUpper<sup>8+</sup> ### getUpper<sup>8+</sup>
getUpper():ScopeType getUpper(): ScopeType
Obtains the upper limit of this **Scope**. Obtains the upper limit of this **Scope**.
...@@ -1235,7 +1235,7 @@ Obtains the upper limit of this **Scope**. ...@@ -1235,7 +1235,7 @@ Obtains the upper limit of this **Scope**.
### getLower<sup>8+</sup> ### getLower<sup>8+</sup>
getLower():ScopeType getLower(): ScopeType
Obtains the lower limit of this **Scope**. Obtains the lower limit of this **Scope**.
...@@ -1257,7 +1257,7 @@ Obtains the lower limit of this **Scope**. ...@@ -1257,7 +1257,7 @@ Obtains the lower limit of this **Scope**.
### expand<sup>8+</sup> ### expand<sup>8+</sup>
expand(lowerObj:ScopeType,upperObj:ScopeType):Scope expand(lowerObj: ScopeType,upperObj: ScopeType): Scope
Obtains the union set of this **Scope** and the given lower and upper limits. Obtains the union set of this **Scope** and the given lower and upper limits.
...@@ -1317,7 +1317,7 @@ Obtains the union set of this **Scope** and the given **Scope**. ...@@ -1317,7 +1317,7 @@ Obtains the union set of this **Scope** and the given **Scope**.
### expand<sup>8+</sup> ### expand<sup>8+</sup>
expand(value:ScopeType):Scope expand(value: ScopeType): Scope
Obtains the union set of this **Scope** and the given value. Obtains the union set of this **Scope** and the given value.
...@@ -1345,7 +1345,7 @@ Obtains the union set of this **Scope** and the given value. ...@@ -1345,7 +1345,7 @@ Obtains the union set of this **Scope** and the given value.
### contains<sup>8+</sup> ### contains<sup>8+</sup>
contains(value:ScopeType):boolean contains(value: ScopeType): boolean
Checks whether a value is within this **Scope**. Checks whether a value is within this **Scope**.
...@@ -1373,7 +1373,7 @@ Checks whether a value is within this **Scope**. ...@@ -1373,7 +1373,7 @@ Checks whether a value is within this **Scope**.
### contains<sup>8+</sup> ### contains<sup>8+</sup>
contains(range:Scope):boolean contains(range: Scope): boolean
Checks whether a range is within this **Scope**. Checks whether a range is within this **Scope**.
...@@ -1403,7 +1403,7 @@ Checks whether a range is within this **Scope**. ...@@ -1403,7 +1403,7 @@ Checks whether a range is within this **Scope**.
### clamp<sup>8+</sup> ### clamp<sup>8+</sup>
clamp(value:ScopeType):ScopeType clamp(value: ScopeType): ScopeType
Limits a value to this **Scope**. Limits a value to this **Scope**.
...@@ -1448,7 +1448,7 @@ A constructor used to create a **Base64** object. ...@@ -1448,7 +1448,7 @@ A constructor used to create a **Base64** object.
### encodeSync<sup>8+</sup> ### encodeSync<sup>8+</sup>
encodeSync(src:Uint8Array):Uint8Array encodeSync(src: Uint8Array): Uint8Array
Encodes the input content. Encodes the input content.
...@@ -1474,7 +1474,7 @@ Encodes the input content. ...@@ -1474,7 +1474,7 @@ Encodes the input content.
### encodeToStringSync<sup>8+</sup> ### encodeToStringSync<sup>8+</sup>
encodeToStringSync(src:Uint8Array):string encodeToStringSync(src: Uint8Array): string
Encodes the input content. Encodes the input content.
...@@ -1500,7 +1500,7 @@ Encodes the input content. ...@@ -1500,7 +1500,7 @@ Encodes the input content.
### decodeSync<sup>8+</sup> ### decodeSync<sup>8+</sup>
decodeSync(src:Uint8Array | string):Uint8Array decodeSync(src: Uint8Array | string): Uint8Array
Decodes the input content. Decodes the input content.
...@@ -1526,7 +1526,7 @@ Decodes the input content. ...@@ -1526,7 +1526,7 @@ Decodes the input content.
### encode<sup>8+</sup> ### encode<sup>8+</sup>
encode(src:Uint8Array):Promise&lt;Uint8Array&gt; encode(src: Uint8Array): Promise&lt;Uint8Array&gt;
Encodes the input content asynchronously. Encodes the input content asynchronously.
...@@ -1557,7 +1557,7 @@ Encodes the input content asynchronously. ...@@ -1557,7 +1557,7 @@ Encodes the input content asynchronously.
### encodeToString<sup>8+</sup> ### encodeToString<sup>8+</sup>
encodeToString(src:Uint8Array):Promise&lt;string&gt; encodeToString(src: Uint8Array): Promise&lt;string&gt;
Encodes the input content asynchronously. Encodes the input content asynchronously.
...@@ -1585,7 +1585,7 @@ Encodes the input content asynchronously. ...@@ -1585,7 +1585,7 @@ Encodes the input content asynchronously.
### decode<sup>8+</sup> ### decode<sup>8+</sup>
decode(src:Uint8Array | string):Promise&lt;Uint8Array&gt; decode(src: Uint8Array | string): Promise&lt;Uint8Array&gt;
Decodes the input content asynchronously. Decodes the input content asynchronously.
...@@ -1633,7 +1633,7 @@ A constructor used to create a **Types** object. ...@@ -1633,7 +1633,7 @@ A constructor used to create a **Types** object.
### isAnyArrayBuffer<sup>8+</sup> ### isAnyArrayBuffer<sup>8+</sup>
isAnyArrayBuffer(value: Object):boolean isAnyArrayBuffer(value: Object): boolean
Checks whether the input value is of the **ArrayBuffer** type. Checks whether the input value is of the **ArrayBuffer** type.
...@@ -1658,7 +1658,7 @@ Checks whether the input value is of the **ArrayBuffer** type. ...@@ -1658,7 +1658,7 @@ Checks whether the input value is of the **ArrayBuffer** type.
### isArrayBufferView<sup>8+</sup> ### isArrayBufferView<sup>8+</sup>
isArrayBufferView(value: Object):boolean isArrayBufferView(value: Object): boolean
Checks whether the input value is of the **ArrayBufferView** type. Checks whether the input value is of the **ArrayBufferView** type.
...@@ -1685,7 +1685,7 @@ Checks whether the input value is of the **ArrayBufferView** type. ...@@ -1685,7 +1685,7 @@ Checks whether the input value is of the **ArrayBufferView** type.
### isArgumentsObject<sup>8+</sup> ### isArgumentsObject<sup>8+</sup>
isArgumentsObject(value: Object):boolean isArgumentsObject(value: Object): boolean
Checks whether the input value is of the **arguments** type. Checks whether the input value is of the **arguments** type.
...@@ -1713,7 +1713,7 @@ Checks whether the input value is of the **arguments** type. ...@@ -1713,7 +1713,7 @@ Checks whether the input value is of the **arguments** type.
### isArrayBuffer<sup>8+</sup> ### isArrayBuffer<sup>8+</sup>
isArrayBuffer(value: Object):boolean isArrayBuffer(value: Object): boolean
Checks whether the input value is of the **ArrayBuffer** type. Checks whether the input value is of the **ArrayBuffer** type.
...@@ -1738,7 +1738,7 @@ Checks whether the input value is of the **ArrayBuffer** type. ...@@ -1738,7 +1738,7 @@ Checks whether the input value is of the **ArrayBuffer** type.
### isAsyncFunction<sup>8+</sup> ### isAsyncFunction<sup>8+</sup>
isAsyncFunction(value: Object):boolean isAsyncFunction(value: Object): boolean
Checks whether the input value is an asynchronous function. Checks whether the input value is an asynchronous function.
...@@ -1763,7 +1763,7 @@ Checks whether the input value is an asynchronous function. ...@@ -1763,7 +1763,7 @@ Checks whether the input value is an asynchronous function.
### isBooleanObject<sup>8+</sup> ### isBooleanObject<sup>8+</sup>
isBooleanObject(value: Object):boolean isBooleanObject(value: Object): boolean
Checks whether the input value is of the **Boolean** type. Checks whether the input value is of the **Boolean** type.
...@@ -1788,7 +1788,7 @@ Checks whether the input value is of the **Boolean** type. ...@@ -1788,7 +1788,7 @@ Checks whether the input value is of the **Boolean** type.
### isBoxedPrimitive<sup>8+</sup> ### isBoxedPrimitive<sup>8+</sup>
isBoxedPrimitive(value: Object):boolean isBoxedPrimitive(value: Object): boolean
Checks whether the input value is of the **Boolean**, **Number**, **String**, or **Symbol** type. Checks whether the input value is of the **Boolean**, **Number**, **String**, or **Symbol** type.
...@@ -1813,7 +1813,7 @@ Checks whether the input value is of the **Boolean**, **Number**, **String**, or ...@@ -1813,7 +1813,7 @@ Checks whether the input value is of the **Boolean**, **Number**, **String**, or
### isDataView<sup>8+</sup> ### isDataView<sup>8+</sup>
isDataView(value: Object):boolean isDataView(value: Object): boolean
Checks whether the input value is of the **DataView** type. Checks whether the input value is of the **DataView** type.
...@@ -1839,7 +1839,7 @@ Checks whether the input value is of the **DataView** type. ...@@ -1839,7 +1839,7 @@ Checks whether the input value is of the **DataView** type.
### isDate<sup>8+</sup> ### isDate<sup>8+</sup>
isDate(value: Object):boolean isDate(value: Object): boolean
Checks whether the input value is of the **Date** type. Checks whether the input value is of the **Date** type.
...@@ -1864,7 +1864,7 @@ Checks whether the input value is of the **Date** type. ...@@ -1864,7 +1864,7 @@ Checks whether the input value is of the **Date** type.
### isExternal<sup>8+</sup> ### isExternal<sup>8+</sup>
isExternal(value: Object):boolean isExternal(value: Object): boolean
Checks whether the input value is of the **native external** type. Checks whether the input value is of the **native external** type.
...@@ -1890,7 +1890,7 @@ Checks whether the input value is of the **native external** type. ...@@ -1890,7 +1890,7 @@ Checks whether the input value is of the **native external** type.
### isFloat32Array<sup>8+</sup> ### isFloat32Array<sup>8+</sup>
isFloat32Array(value: Object):boolean isFloat32Array(value: Object): boolean
Checks whether the input value is of the **Float32Array** type. Checks whether the input value is of the **Float32Array** type.
...@@ -1915,7 +1915,7 @@ Checks whether the input value is of the **Float32Array** type. ...@@ -1915,7 +1915,7 @@ Checks whether the input value is of the **Float32Array** type.
### isFloat64Array<sup>8+</sup> ### isFloat64Array<sup>8+</sup>
isFloat64Array(value: Object):boolean isFloat64Array(value: Object): boolean
Checks whether the input value is of the **Float64Array** type. Checks whether the input value is of the **Float64Array** type.
...@@ -1940,7 +1940,7 @@ Checks whether the input value is of the **Float64Array** type. ...@@ -1940,7 +1940,7 @@ Checks whether the input value is of the **Float64Array** type.
### isGeneratorFunction<sup>8+</sup> ### isGeneratorFunction<sup>8+</sup>
isGeneratorFunction(value: Object):boolean isGeneratorFunction(value: Object): boolean
Checks whether the input value is a generator function. Checks whether the input value is a generator function.
...@@ -1965,7 +1965,7 @@ Checks whether the input value is a generator function. ...@@ -1965,7 +1965,7 @@ Checks whether the input value is a generator function.
### isGeneratorObject<sup>8+</sup> ### isGeneratorObject<sup>8+</sup>
isGeneratorObject(value: Object):boolean isGeneratorObject(value: Object): boolean
Checks whether the input value is a generator object. Checks whether the input value is a generator object.
...@@ -1992,7 +1992,7 @@ Checks whether the input value is a generator object. ...@@ -1992,7 +1992,7 @@ Checks whether the input value is a generator object.
### isInt8Array<sup>8+</sup> ### isInt8Array<sup>8+</sup>
isInt8Array(value: Object):boolean isInt8Array(value: Object): boolean
Checks whether the input value is of the **Int8Array** type. Checks whether the input value is of the **Int8Array** type.
...@@ -2017,7 +2017,7 @@ Checks whether the input value is of the **Int8Array** type. ...@@ -2017,7 +2017,7 @@ Checks whether the input value is of the **Int8Array** type.
### isInt16Array<sup>8+</sup> ### isInt16Array<sup>8+</sup>
isInt16Array(value: Object):boolean isInt16Array(value: Object): boolean
Checks whether the input value is of the **Int16Array** type. Checks whether the input value is of the **Int16Array** type.
...@@ -2042,7 +2042,7 @@ Checks whether the input value is of the **Int16Array** type. ...@@ -2042,7 +2042,7 @@ Checks whether the input value is of the **Int16Array** type.
### isInt32Array<sup>8+</sup> ### isInt32Array<sup>8+</sup>
isInt32Array(value: Object):boolean isInt32Array(value: Object): boolean
Checks whether the input value is of the **Int32Array** type. Checks whether the input value is of the **Int32Array** type.
...@@ -2067,7 +2067,7 @@ Checks whether the input value is of the **Int32Array** type. ...@@ -2067,7 +2067,7 @@ Checks whether the input value is of the **Int32Array** type.
### isMap<sup>8+</sup> ### isMap<sup>8+</sup>
isMap(value: Object):boolean isMap(value: Object): boolean
Checks whether the input value is of the **Map** type. Checks whether the input value is of the **Map** type.
...@@ -2092,7 +2092,7 @@ Checks whether the input value is of the **Map** type. ...@@ -2092,7 +2092,7 @@ Checks whether the input value is of the **Map** type.
### isMapIterator<sup>8+</sup> ### isMapIterator<sup>8+</sup>
isMapIterator(value: Object):boolean isMapIterator(value: Object): boolean
Checks whether the input value is of the **MapIterator** type. Checks whether the input value is of the **MapIterator** type.
...@@ -2118,7 +2118,7 @@ Checks whether the input value is of the **MapIterator** type. ...@@ -2118,7 +2118,7 @@ Checks whether the input value is of the **MapIterator** type.
### isNativeError<sup>8+</sup> ### isNativeError<sup>8+</sup>
isNativeError(value: Object):boolean isNativeError(value: Object): boolean
Checks whether the input value is of the **Error** type. Checks whether the input value is of the **Error** type.
...@@ -2143,7 +2143,7 @@ Checks whether the input value is of the **Error** type. ...@@ -2143,7 +2143,7 @@ Checks whether the input value is of the **Error** type.
### isNumberObject<sup>8+</sup> ### isNumberObject<sup>8+</sup>
isNumberObject(value: Object):boolean isNumberObject(value: Object): boolean
Checks whether the input value is a number object. Checks whether the input value is a number object.
...@@ -2168,7 +2168,7 @@ Checks whether the input value is a number object. ...@@ -2168,7 +2168,7 @@ Checks whether the input value is a number object.
### isPromise<sup>8+</sup> ### isPromise<sup>8+</sup>
isPromise(value: Object):boolean isPromise(value: Object): boolean
Checks whether the input value is a promise. Checks whether the input value is a promise.
...@@ -2193,7 +2193,7 @@ Checks whether the input value is a promise. ...@@ -2193,7 +2193,7 @@ Checks whether the input value is a promise.
### isProxy<sup>8+</sup> ### isProxy<sup>8+</sup>
isProxy(value: Object):boolean isProxy(value: Object): boolean
Checks whether the input value is a proxy. Checks whether the input value is a proxy.
...@@ -2220,7 +2220,7 @@ Checks whether the input value is a proxy. ...@@ -2220,7 +2220,7 @@ Checks whether the input value is a proxy.
### isRegExp<sup>8+</sup> ### isRegExp<sup>8+</sup>
isRegExp(value: Object):boolean isRegExp(value: Object): boolean
Checks whether the input value is of the **RegExp** type. Checks whether the input value is of the **RegExp** type.
...@@ -2245,7 +2245,7 @@ Checks whether the input value is of the **RegExp** type. ...@@ -2245,7 +2245,7 @@ Checks whether the input value is of the **RegExp** type.
### isSet<sup>8+</sup> ### isSet<sup>8+</sup>
isSet(value: Object):boolean isSet(value: Object): boolean
Checks whether the input value is of the **Set** type. Checks whether the input value is of the **Set** type.
...@@ -2270,7 +2270,7 @@ Checks whether the input value is of the **Set** type. ...@@ -2270,7 +2270,7 @@ Checks whether the input value is of the **Set** type.
### isSetIterator<sup>8+</sup> ### isSetIterator<sup>8+</sup>
isSetIterator(value: Object):boolean isSetIterator(value: Object): boolean
Checks whether the input value is of the **SetIterator** type. Checks whether the input value is of the **SetIterator** type.
...@@ -2296,7 +2296,7 @@ Checks whether the input value is of the **SetIterator** type. ...@@ -2296,7 +2296,7 @@ Checks whether the input value is of the **SetIterator** type.
### isStringObject<sup>8+</sup> ### isStringObject<sup>8+</sup>
isStringObject(value: Object):boolean isStringObject(value: Object): boolean
Checks whether the input value is a string object. Checks whether the input value is a string object.
...@@ -2347,7 +2347,7 @@ Checks whether the input value is a symbol object. ...@@ -2347,7 +2347,7 @@ Checks whether the input value is a symbol object.
### isTypedArray<sup>8+</sup> ### isTypedArray<sup>8+</sup>
isTypedArray(value: Object):boolean isTypedArray(value: Object): boolean
Checks whether the input value is of the **TypedArray** type. Checks whether the input value is of the **TypedArray** type.
...@@ -2374,7 +2374,7 @@ Checks whether the input value is of the **TypedArray** type. ...@@ -2374,7 +2374,7 @@ Checks whether the input value is of the **TypedArray** type.
### isUint8Array<sup>8+</sup> ### isUint8Array<sup>8+</sup>
isUint8Array(value: Object):boolean isUint8Array(value: Object): boolean
Checks whether the input value is of the **Uint8Array** type. Checks whether the input value is of the **Uint8Array** type.
...@@ -2399,7 +2399,7 @@ Checks whether the input value is of the **Uint8Array** type. ...@@ -2399,7 +2399,7 @@ Checks whether the input value is of the **Uint8Array** type.
### isUint8ClampedArray<sup>8+</sup> ### isUint8ClampedArray<sup>8+</sup>
isUint8ClampedArray(value: Object):boolean isUint8ClampedArray(value: Object): boolean
Checks whether the input value is of the **Uint8ClampedArray** type. Checks whether the input value is of the **Uint8ClampedArray** type.
...@@ -2424,7 +2424,7 @@ Checks whether the input value is of the **Uint8ClampedArray** type. ...@@ -2424,7 +2424,7 @@ Checks whether the input value is of the **Uint8ClampedArray** type.
### isUint16Array<sup>8+</sup> ### isUint16Array<sup>8+</sup>
isUint16Array(value: Object):boolean isUint16Array(value: Object): boolean
Checks whether the input value is of the **Uint16Array** type. Checks whether the input value is of the **Uint16Array** type.
...@@ -2449,7 +2449,7 @@ Checks whether the input value is of the **Uint16Array** type. ...@@ -2449,7 +2449,7 @@ Checks whether the input value is of the **Uint16Array** type.
### isUint32Array<sup>8+</sup> ### isUint32Array<sup>8+</sup>
isUint32Array(value: Object):boolean isUint32Array(value: Object): boolean
Checks whether the input value is of the **Uint32Array** type. Checks whether the input value is of the **Uint32Array** type.
...@@ -2474,7 +2474,7 @@ Checks whether the input value is of the **Uint32Array** type. ...@@ -2474,7 +2474,7 @@ Checks whether the input value is of the **Uint32Array** type.
### isWeakMap<sup>8+</sup> ### isWeakMap<sup>8+</sup>
isWeakMap(value: Object):boolean isWeakMap(value: Object): boolean
Checks whether the input value is of the **WeakMap** type. Checks whether the input value is of the **WeakMap** type.
...@@ -2499,7 +2499,7 @@ Checks whether the input value is of the **WeakMap** type. ...@@ -2499,7 +2499,7 @@ Checks whether the input value is of the **WeakMap** type.
### isWeakSet<sup>8+</sup> ### isWeakSet<sup>8+</sup>
isWeakSet(value: Object):boolean isWeakSet(value: Object): boolean
Checks whether the input value is of the **WeakSet** type. Checks whether the input value is of the **WeakSet** type.
......
...@@ -28,6 +28,28 @@ None ...@@ -28,6 +28,28 @@ None
| target<sup>8+</sup> | EventTarget | Target element that is clicked. | | target<sup>8+</sup> | EventTarget | Target element that is clicked. |
| timestamp | number | Timestamp of the event. | | timestamp | number | Timestamp of the event. |
- EventTarget<sup>8+</sup> attributes
| Name | Type | Description |
| -------- | -------- | -------- |
| area | Area | Area information of the target element.|
- Area<sup>8+</sup> attributes
| Name | Type | Description |
| -------- | -------- | -------- |
| width | number | Width of the target element, in vp. |
| height | number | Height of the target element, in vp. |
| pos | Position | Position of the upper left corner of the target element relative to that of the parent element. |
| globalPos | Position | Position of the upper left corner of the target element relative to that of the page. |
- Position<sup>8+</sup> attributes
| Name | Type | Description |
| -------- | -------- | -------- |
| x | number | X-coordinate, in vp. |
| y | number | Y-coordinate, in vp. |
## Example ## Example
......
# Learn About OpenHarmony
- [OpenHarmony Project](OpenHarmony-Overview.md)
- [Glossary](device-dev/glossary/glossary.md)
- OpenHarmony Release Notes
- OpenHarmony 3.x Releases
- [OpenHarmony v3.1 Beta (2021-12-31)](release-notes/OpenHarmony-v3.1-beta.md)
- [OpenHarmony v3.0.1 LTS (2022-01-12)](release-notes/OpenHarmony-v3.0.1-LTS.md)
- [OpenHarmony v3.0 LTS (2021-09-30)](release-notes/OpenHarmony-v3.0-LTS.md)
- OpenHarmony 2.x Releases
- [OpenHarmony v2.2 beta2 (2021-08-04)](release-notes/OpenHarmony-v2.2-beta2.md)
- [OpenHarmony 2.0 Canary (2021-06-01)](release-notes/OpenHarmony-2-0-Canary.md)
- OpenHarmony 1.x Releases
- [OpenHarmony v1.1.4 LTS (2022-02-11)](release-notes/OpenHarmony-v1-1-4-LTS.md)
- [OpenHarmony v1.1.3 LTS (2021-09-30)](release-notes/OpenHarmony-v1-1-3-LTS.md)
- [OpenHarmony v1.1.2 LTS (2021-08-04)](release-notes/OpenHarmony-v1.1.2-LTS.md)
- [OpenHarmony 1.1.1 LTS (2021-06-22)](release-notes/OpenHarmony-1-1-1-LTS.md)
- [OpenHarmony 1.1.0 LTS (2021-04-01)](release-notes/OpenHarmony-1-1-0-LTS.md)
- [OpenHarmony 1.0 (2020-09-10)](release-notes/OpenHarmony-1-0.md)
- Contribution
- [Contribution](contribute/contribution.md)
- [Code of Conduct](contribute/code-of-conduct.md)
- [Code Contribution](contribute/code-contribution.md)
- [Contribution Process](contribute/contribution-process.md)
- [Auto-Test](readme/test_subsystem.md)
- [Documentation Contribution](contribute/documentation-contribution.md)
- [Writing Instructions](contribute/writing-instructions.md)
- [Communication in Community](contribute/communication-in-community.md)
- [FAQs](contribute/FAQ.md)
\ No newline at end of file
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
- [设备管理](device/Readme-CN.md) - [设备管理](device/Readme-CN.md)
- [设备使用信息统计](device-usage-statistics/Readme-CN.md) - [设备使用信息统计](device-usage-statistics/Readme-CN.md)
- [DFX](dfx/Readme-CN.md) - [DFX](dfx/Readme-CN.md)
- [国际化](internationalization/Readme-CN.md)
- 工具 - 工具
- [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md) - [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md)
- 示例教程 - 示例教程
......
...@@ -2,9 +2,60 @@ ...@@ -2,9 +2,60 @@
应用开发文档用于指导开发者通过OpenHarmony提供的接口完成应用开发。当前应用开发文档提供了在标准系统上开发应用的JS接口。 应用开发文档用于指导开发者通过OpenHarmony提供的接口完成应用开发。当前应用开发文档提供了在标准系统上开发应用的JS接口。
这部分中,开发者可以通过“[入门](quick-start/Readme-CN.md)”来了解应用开发的基本方法。完整的接口清单和参考使用指导可参见“[开发参考](reference/Readme-CN.md)”。 应用开发的文档中,您可以获取到如下几方面的内容:
除此之外,为方便开发者对常用功能进行深入理解,还提供了[UI](ui/Readme-CN.md)[媒体](media/Readme-CN.md)[网络与连接](connectivity/Readme-CN.md)三个模块的开发指南。 ### 入门
如果需要了解各子系统的原理和基本信息,可以参考“docs/zh-cn/readme”目录中各子系统readme的介绍。 [入门部分](quick-start/Readme-CN.md),可以帮助开发者了解应用开发的基本方法。
这一部分包含了IDE工具DevEco Studio的基本使用方法,以及快速构建首个应用的快速入门。
此外,还在此部分详述了OpenHarmony应用包的包结构,以及资源文件的使用指导。
### 开发
为了帮助开发者更好的理解OpenHarmony提供的能力,我们对重点功能提供了开发指导,辅助开发者完成应用的开发。
首先,提供了支撑OpenHarmony应用的两个重要框架:
- 应用程序的框架:[Ability开发](ability/Readme-CN.md)
- UI的框架:[UI开发](ui/Readme-CN.md)
所有应用都应该在这两个框架下填充和完善功能内容。
在此基础上,还提供了如下功能的开发指导:
- [窗口管理](windowmanager/Readme-CN.md)
- [WebGL](webgl/Readme-CN.md)
- [媒体](media/Readme-CN.md)
- [安全](security/Readme-CN.md)
- [网络与连接](connectivity/Readme-CN.md)
- [数据管理](database/Readme-CN.md)
- [后台代理提醒](background-agent-scheduled-reminder/Readme-CN.md)
- [后台任务管理](background-task-management/Readme-CN.md)
- [设备管理](device/Readme-CN.md)
- [设备使用信息统计](device-usage-statistics/Readme-CN.md)
- [DFX](dfx/Readme-CN.md)
### 工具
DevEco Studio工具是OpenHarmony应用开发的推荐IDE工具。
[工具](quick-start/deveco-studio-user-guide-for-openharmony.md)部分,讲解了DevEco Studio工具的详细用法,包括使用该工具进行工程创建、应用签名、应用调试、应用安装运行的指导。
### 示例教程
我们提供了[Sample工程](https://gitee.com/openharmony/app_samples/blob/master/README_zh.md)[Codelab](https://gitee.com/openharmony/codelabs/blob/master/README.md)这两种形式的示例教程,为开发者提供更丰富的开发参考,辅助开发者理解功能逻辑,提升开发效率。
### API参考
API参考提供了OpenHarmony全量组件和接口的参考文档,可以帮助开发者快速查找到指定接口的详细描述和调用方法。
内容包括:
- [组件参考(基于JS扩展的类Web开发范式)](reference/arkui-js/Readme-CN.md)
- [组件参考(基于TS扩展的声明式开发范式)](reference/arkui-ts/Readme-CN.md)
- [接口参考](reference/apis/Readme-CN.md)
### Readme
如果需要了解各子系统的原理和基本信息,可以参考“[docs/zh-cn/readme](../readme)”目录中各子系统readme的介绍。
...@@ -36,7 +36,13 @@ ...@@ -36,7 +36,13 @@
- [通过导入Sample方式创建新工程](quick-start/import-sample-to-create-project.md) - [通过导入Sample方式创建新工程](quick-start/import-sample-to-create-project.md)
- [配置OpenHarmony应用签名信息](quick-start/configuring-openharmony-app-signature.md) - [配置OpenHarmony应用签名信息](quick-start/configuring-openharmony-app-signature.md)
- [安装运行OpenHarmony应用](quick-start/installing-openharmony-app.md) - [安装运行OpenHarmony应用](quick-start/installing-openharmony-app.md)
- 快速入门
- [前言](start-overview.md)
- [使用eTS语言开发](start-with-ets.md)
- [使用JS语言开发(传统代码方式)](start-with-js.md)
- [使用JS语言开发(低代码方式)](start-with-js-low-code.md)
- [应用开发包结构说明](quick-start/quick-start/package-structure.md) - [应用开发包结构说明](quick-start/quick-start/package-structure.md)
- [资源文件的分类](quick-start/basic-resource-file-categories.md)
- 开发 - 开发
- [Ability开发](ability/Readme-CN.md) - [Ability开发](ability/Readme-CN.md)
- [Ability框架概述](ability/ability-brief.md) - [Ability框架概述](ability/ability-brief.md)
...@@ -84,22 +90,46 @@ ...@@ -84,22 +90,46 @@
- [动画](ui/ui-js-building-ui-animation.md) - [动画](ui/ui-js-building-ui-animation.md)
- [事件](ui/ui-js-building-ui-event.md) - [事件](ui/ui-js-building-ui-event.md)
- [页面路由](ui/ui-js-building-ui-routes.md) - [页面路由](ui/ui-js-building-ui-routes.md)
- 常见组件开发指导 - 常见组件开发指导
- [Text](ui/ui-js-components-text.md) - 容器组件
- [Input](ui/ui-js-components-input.md) - [List开发指导](ui/ui-js-components-list.md)
- [Button](ui/ui-js-components-button.md) - [Dialog开发指导](ui/ui-js-components-dialog.md)
- [List](ui/ui-js-components-list.md) - [Form开发指导](ui/ui-js-components-form.md)
- [Picker](ui/ui-js-components-picker.md) - [Stepper开发指导](ui/ui-js-components-stepper.md)
- [Dialog](ui/ui-js-components-dialog.md) - [Tabs开发指导](ui/ui-js-component-tabs.md)
- [Form](ui/ui-js-components-form.md) - [Swiper开发指导](ui/ui-js-components-swiper.md)
- [Stepper](ui/ui-js-components-stepper.md) - 基础组件
- [Tabs](ui/ui-js-component-tabs.md) - [Text开发指导](ui/ui-js-components-text.md)
- [Image](ui/ui-js-components-images.md) - [Input开发指导](ui/ui-js-components-input.md)
- [Button开发指导](ui/ui-js-components-button.md)
- [Picker开发指导](ui/ui-js-components-picker.md)
- [Image开发指导](ui/ui-js-components-images.md)
- [Image-animator开发指导](ui/ui-js-components-image-animator.md)
- [Rating开发指导](ui/ui-js-components-rating.md)
- [Slider开发指导](ui/ui-js-components-slider.md)
- [Chart开发指导](ui/ui-js-components-chart.md)
- [Switch开发指导](ui/ui-js-components-switch.md)
- [Toolbar开发指导](ui/ui-js-components-toolbar.md)
- [Menu开发指导](ui/ui-js-components-menu.md)
- [Marquee开发指导](ui/ui-js-components-marquee.md)
- [Qrcode开发指导](ui/ui-js-components-qrcode.md)
- [Search开发指导](ui/ui-js-components-search.md)
- Canvas开发指导
- [CanvasRenderingContext2D对象](ui/ui-js-components-canvasrenderingcontext2d.md)
- [Path2D对象](ui/ui-js-components-path2d.md)
- [OffscreenCanvas对象](ui/ui-js-components-offscreencanvas.md)
- [栅格布局](ui/ui-js-components-calendar.md)
- Svg开发指导
- [基础知识](ui/ui-js-components-svg-overview.md)
- [绘制图形](ui/ui-js-components-svg-graphics.md)
- [绘制路径](ui/ui-js-components-svg-path.md)
- [绘制文本](ui/ui-js-components-svg-text.md)
- 动效开发指导 - 动效开发指导
- CSS动画 - CSS动画
- [属性样式动画](ui/ui-js-animate-attribute-style.md) - [属性样式动画](ui/ui-js-animate-attribute-style.md)
- [transform样式动画](ui/ui-js-animate-transform.md) - [transform样式动画](ui/ui-js-animate-transform.md)
- [background-position样式动画](ui/ui-js-animate-background-position-style.md) - [background-position样式动画](ui/ui-js-animate-background-position-style.md)
- [svg动画](ui/ui-js-animate-svg.md)
- JS动画 - JS动画
- [组件动画](ui/ui-js-animate-component.md) - [组件动画](ui/ui-js-animate-component.md)
- 插值器动画 - 插值器动画
...@@ -242,6 +272,12 @@ ...@@ -242,6 +272,12 @@
- [位置开发概述](device/device-location-overview.md) - [位置开发概述](device/device-location-overview.md)
- [获取设备的位置信息](device/device-location-info.md) - [获取设备的位置信息](device/device-location-info.md)
- [(逆)地理编码转化](device/device-location-geocoding.md) - [(逆)地理编码转化](device/device-location-geocoding.md)
- 传感器
- [传感器开发概述](device/sensor-overview.md)
- [传感器开发指导](device/sensor-guidelines.md)
- 振动
- [振动开发概述](device/vibrator-guidelines.md)
- [振动开发指导](device/vibrator-guidelines.md)
- [设备使用信息统计](device-usage-statistics/Readme-CN.md) - [设备使用信息统计](device-usage-statistics/Readme-CN.md)
- [设备使用信息统计概述](device-usage-statistics/device-usage-statistics-overview.md) - [设备使用信息统计概述](device-usage-statistics/device-usage-statistics-overview.md)
- [设备使用信息统计开发指导](device-usage-statistics/device-usage-statistics-dev-guide.md) - [设备使用信息统计开发指导](device-usage-statistics/device-usage-statistics-dev-guide.md)
...@@ -255,6 +291,10 @@ ...@@ -255,6 +291,10 @@
- 分布式跟踪 - 分布式跟踪
- [分布式跟踪概述](dfx/hitracechain-overview.md) - [分布式跟踪概述](dfx/hitracechain-overview.md)
- [分布式跟踪开发指导](dfx/hitracechain-guidelines.md) - [分布式跟踪开发指导](dfx/hitracechain-guidelines.md)
- [国际化](international/Readme-CN.md)
- [国际化开发概述](international/international-overview.md)
- [Intl开发指导](international/intl-guidelines.md)
- [I18n开发指导](international/i18n-guidelines.md)
- 工具 - 工具
- [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md) - [DevEco Studio(OpenHarmony)使用指南](quick-start/deveco-studio-user-guide-for-openharmony.md)
- [概述](quick-start/deveco-studio-overview.md) - [概述](quick-start/deveco-studio-overview.md)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
**表1** 分布式数据对象实例创建接口 **表1** 分布式数据对象实例创建接口
| 包名 | 接口名 | 描述 | | 包名 | 接口名 | 描述 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | 创建一个分布式数据对象实例,用于数据操作 | | ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | 创建一个分布式数据对象实例,用于数据操作 <br>-&nbsp;source:设置distributedObject的属性。<br>-&nbsp;DistributedObject:返回值是创建好的分布式对象。|
### 创建分布式数据对象sessionId ### 创建分布式数据对象sessionId
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
**表3** 分布式数据对象sessionId设置接口 **表3** 分布式数据对象sessionId设置接口
| 类名 | 接口名 | 描述 | | 类名 | 接口名 | 描述 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| DistributedDataObject | setSessionId(sessionId?: string): boolean | 为分布式数据对象设置sessionId | | DistributedDataObject | setSessionId(sessionId?: string): boolean | 为分布式数据对象设置sessionId <br>&nbsp;sessionId:如果指定sessionId,则退出指定分布式组网;如果不指定,则全部退出。|
### 订阅数据变更 ### 订阅数据变更
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
| 类名 | 接口名 | 描述 | | 类名 | 接口名 | 描述 |
| -------- | -------- | -------- | | -------- | -------- | -------- |
| DistributedDataObject| on(type: 'change', callback: Callback<{ sessionId: string, fields: Array&lt;string&gt; }>): void | 订阅数据变更。 | | DistributedDataObject| on(type: 'change', callback: Callback<{ sessionId: string, fields: Array&lt;string&gt; }>): void | 订阅数据变更。 |
| DistributedDataObject| off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array&lt;string&gt; }>): void | 注销订阅。 | | DistributedDataObject| off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array&lt;string&gt; }>): void | 注销订阅。需要删除的变更回调,若不设置则删除该对象所有的变更回调。 |
### 订阅数据对象上下线 ### 订阅数据对象上下线
...@@ -83,12 +83,12 @@ ...@@ -83,12 +83,12 @@
//发起方 //发起方
var local_object = distributedObject.createDistributedObject({name:"jack", age:18, isVis:true, var local_object = distributedObject.createDistributedObject({name:"jack", age:18, isVis:true,
parent:{mother:"jack mom",father:"jack Dad"},[{mother:"jack mom"}, {father:"jack Dad"}]}; parent:{mother:"jack mom",father:"jack Dad"},[{mother:"jack mom"}, {father:"jack Dad"}]};
local_object.setsessionId(sessionId); local_object.setSessionId(sessionId);
//被起方 //被起方
var remote_object = distributedObject.createDistributedObject({name:undefined, age:undefined, isVis:true, var remote_object = distributedObject.createDistributedObject({name:undefined, age:undefined, isVis:true,
parent:undefined, list:undefined}); parent:undefined, list:undefined});
remote_object.setsessionId(sessionId); remote_object.setSessionId(sessionId);
//收到status上线后remote_object同步数据,即name变成jack,age是18 //收到status上线后remote_object同步数据,即name变成jack,age是18
``` ```
......
...@@ -207,12 +207,12 @@ ...@@ -207,12 +207,12 @@
示例代码如下: 示例代码如下:
``` ```
import dataRdb from '@ohos.data.rdb'; import data_rdb from '@ohos.data.rdb'
const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"; const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)";
const STORE_CONFIG = {name: "rdbstore.db",} const STORE_CONFIG = {name: "rdbstore.db",}
let rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1); let rdbStore = await data_rdb.getRdbStore(STORE_CONFIG, 1);
await rdbStore.executeSql(CREATE_TABLE_TEST); await rdbStore.executeSql(CREATE_TABLE_TEST);
``` ```
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
示例代码如下: 示例代码如下:
``` ```
let predicates = new dataRdb.RdbPredicates("test"); let predicates = new data_rdb.RdbPredicates("test");
predicates.equalTo("name", "Tom") predicates.equalTo("name", "Tom")
let resultSet = await rdbStore.query(predicates) let resultSet = await rdbStore.query(predicates)
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
示例代码如下: 示例代码如下:
``` ```
let predicate = new dataRdb.RdbPredicates('test') let predicate = new data_rdb.RdbPredicates('test')
predicate.inDevices(['12345678abcde']) predicate.inDevices(['12345678abcde'])
let promise = rdbStore.sync(rdb.SyncMode.SYNC_MODE_PUSH, predicate) let promise = rdbStore.sync(rdb.SyncMode.SYNC_MODE_PUSH, predicate)
promise.then(result) { promise.then(result) {
......
...@@ -7,3 +7,9 @@ ...@@ -7,3 +7,9 @@
- [位置开发概述](device-location-overview.md) - [位置开发概述](device-location-overview.md)
- [获取设备的位置信息](device-location-info.md) - [获取设备的位置信息](device-location-info.md)
- [(逆)地理编码转化](device-location-geocoding.md) - [(逆)地理编码转化](device-location-geocoding.md)
- 传感器
- [传感器开发概述](sensor-overview.md)
- [传感器开发指导](sensor-guidelines.md)
- 振动
- [振动开发概述](vibrator-guidelines.md)
- [振动开发指导](vibrator-guidelines.md)
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
应用事件JS打点接口由hiAppEvent模块提供。 应用事件JS打点接口由hiAppEvent模块提供。
以下仅提供简单的接口介绍,API接口的具体使用说明(参数使用限制、具体取值范围等),请参考[应用事件打点API文档](../reference/apis/js-apis-hiappevent.md)
**打点接口功能介绍:** **打点接口功能介绍:**
| 接口名 | 返回值 | 描述 | | 接口名 | 返回值 | 描述 |
...@@ -15,25 +17,6 @@ ...@@ -15,25 +17,6 @@
| write(string eventName, EventType type, object keyValues, AsyncCallback\<void> callback): void | void | 应用事件异步打点方法,使用callback方式作为异步回调。 | | write(string eventName, EventType type, object keyValues, AsyncCallback\<void> callback): void | void | 应用事件异步打点方法,使用callback方式作为异步回调。 |
| write(string eventName, EventType type, object keyValues): Promise\<void> | Promise\<void> | 应用事件异步打点方法,使用promise方式作为异步回调。 | | write(string eventName, EventType type, object keyValues): Promise\<void> | Promise\<void> | 应用事件异步打点方法,使用promise方式作为异步回调。 |
- 参数eventName:开发者自定义事件名称。事件名称在48个字符以内,有效的字符是0-9、a-z、下划线,只能以字母开头。
- 参数type:事件所属的类型,取值为枚举EventType,具体值如下表。
| 类型 | 描述 |
| --------- | -------------- |
| FAULT | 故障类型事件。 |
| STATISTIC | 统计类型事件。 |
| SECURITY | 安全类型事件。 |
| BEHAVIOR | 行为类型事件。 |
- 参数keyValues:事件参数键值对,如果是变长参数类型,则依次输入事件的参数名与参数值。如果是Json对象类型,则Json对象的key是事件的参数名,value是事件的参数值。
- 参数名只支持string类型,参数值只支持boolean、number、string、Array(数组参数值为基本类型)。
- 事件的参数个数必须小于等于32。
- 参数名在16个字符以内,有效的字符是0-9、a-z、下划线,只能以字母开头,不能以下划线结尾。
- string类型参数值在8*1024个字符内。
- Array类型参数值的元素个数必须在100个以内,超出时会进行截断处理。
- 参数callback:回调函数,可以在回调函数中处理接口返回值。返回值为0表示事件参数校验成功,事件正常异步写入事件文件;大于0表示事件存在异常参数,事件在忽略异常参数后再异步写入事件文件;小于0表示事件校验失败,不执行事件异步打点操作。
当采用callback作为异步回调时,可以在callback中进行下一步处理。当采用Promise对象返回时,可以在Promise对象中类似地处理接口返回值。具体结果码说明见[事件校验结果码](hiappevent-overview.md#事件校验结果码) 当采用callback作为异步回调时,可以在callback中进行下一步处理。当采用Promise对象返回时,可以在Promise对象中类似地处理接口返回值。具体结果码说明见[事件校验结果码](hiappevent-overview.md#事件校验结果码)
**打点配置接口功能介绍:** **打点配置接口功能介绍:**
...@@ -42,29 +25,6 @@ ...@@ -42,29 +25,6 @@
| ------------------------------ | ------- | ------------------------------------------------------------ | | ------------------------------ | ------- | ------------------------------------------------------------ |
| configure(ConfigOption config) | boolean | 应用事件打点配置方法,可以对打点功能进行自定义配置。返回true表示配置成功,false表示配置失败。 | | configure(ConfigOption config) | boolean | 应用事件打点配置方法,可以对打点功能进行自定义配置。返回true表示配置成功,false表示配置失败。 |
- 参数config:应用事件打点配置项对象。应用打点配置选项ConfigOption如下表。
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------- | ---- | ------------------------------------------------------------ |
| disable | boolean | 否 | 应用打点功能开关,例如配置值为true表示关闭打点功能。 |
| maxStorage | string | 否 | 打点落盘文件存放目录的配额大小,默认限额为“10M”,超出限额后会对存放目录进行清理。 |
**预定义事件名称常量接口Event:**
| 常量名 | 类型 | 描述 |
| ------------------------- | ------ | ------------------------ |
| USER_LOGIN | string | 用户登录事件名称。 |
| USER_LOGOUT | string | 用户登出事件名称。 |
| DISTRIBUTED_SERVICE_START | string | 分布式服务启动事件名称。 |
**预定义参数名称常量接口Param:**
| 常量名 | 类型 | 描述 |
| ------------------------------- | ------ | ------------------ |
| USER_ID | string | 用户自定义ID。 |
| DISTRIBUTED_SERVICE_NAME | string | 分布式服务名称。 |
| DISTRIBUTED_SERVICE_INSTANCE_ID | string | 分布式服务示例ID。 |
## 开发步骤 ## 开发步骤
在应用启动执行页面加载后,执行一个应用事件打点,用于记录应用的初始页面加载事件。 在应用启动执行页面加载后,执行一个应用事件打点,用于记录应用的初始页面加载事件。
...@@ -112,6 +72,4 @@ ...@@ -112,6 +72,4 @@
} }
``` ```
2. 运行项目,点击应用界面上的运行按钮。 2. 运行项目,点击应用界面上的运行按钮。
\ No newline at end of file
# 国际化 # 国际化
- [国际化开发概述](international-overview.md) - [国际化开发概述](international-overview.md)
- [Intl开发指导](intl-guidelines.md) - [Intl开发指导](intl-guidelines.md)
- [I18n开发指导](i18n-guidelines.md) - [I18n开发指导](i18n-guidelines.md)
# Bundle模块(JS端SDK接口) # Bundle模块(JS端SDK接口)
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块 ## 导入模块
``` ```
...@@ -567,7 +570,7 @@ bundle.getAbilityInfo(bundleName, abilityName, (err, data) => { ...@@ -567,7 +570,7 @@ bundle.getAbilityInfo(bundleName, abilityName, (err, data) => {
}) })
``` ```
## bundle.getAbilityLabel ## bundle.getAbilityLabel<sup>8+</sup>
getAbilityLabel(bundleName: string, abilityName: string): Promise\<string> getAbilityLabel(bundleName: string, abilityName: string): Promise\<string>
...@@ -607,7 +610,7 @@ bundle.getAbilityLabel(bundleName, abilityName) ...@@ -607,7 +610,7 @@ bundle.getAbilityLabel(bundleName, abilityName)
}) })
``` ```
## bundle.getAbilityLabel ## bundle.getAbilityLabel<sup>8+</sup>
getAbilityLabel(bundleName: string, abilityName: string, callback : AsyncCallback\<string>): void getAbilityLabel(bundleName: string, abilityName: string, callback : AsyncCallback\<string>): void
...@@ -643,7 +646,7 @@ bundle.getAbilityLabel(bundleName, abilityName, (err, data) => { ...@@ -643,7 +646,7 @@ bundle.getAbilityLabel(bundleName, abilityName, (err, data) => {
}) })
``` ```
## bundle.isAbilityEnabled ## bundle.isAbilityEnabled<sup>8+</sup>
isAbilityEnabled(info: AbilityInfo): Promise\<boolean> isAbilityEnabled(info: AbilityInfo): Promise\<boolean>
...@@ -684,7 +687,7 @@ bundle.isAbilityEnabled(Info) ...@@ -684,7 +687,7 @@ bundle.isAbilityEnabled(Info)
}) })
``` ```
## bundle.isAbilityEnabled ## bundle.isAbilityEnabled<sup>8+</sup>
isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void
...@@ -721,7 +724,7 @@ bundle.isAbilityEnabled(Info, (err, data) => { ...@@ -721,7 +724,7 @@ bundle.isAbilityEnabled(Info, (err, data) => {
}) })
``` ```
## bundle.isApplicationEnabled ## bundle.isApplicationEnabled<sup>8+</sup>
isApplicationEnabled(bundleName: string): Promise\<boolean> isApplicationEnabled(bundleName: string): Promise\<boolean>
...@@ -759,7 +762,7 @@ bundle.isApplicationEnabled(bundleName) ...@@ -759,7 +762,7 @@ bundle.isApplicationEnabled(bundleName)
}) })
``` ```
## bundle.isApplicationEnabled ## bundle.isApplicationEnabled<sup>8+</sup>
isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): void isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): void
...@@ -1071,7 +1074,7 @@ bundle.getLaunchWantForBundle(bundleName, (err, data) => { ...@@ -1071,7 +1074,7 @@ bundle.getLaunchWantForBundle(bundleName, (err, data) => {
``` ```
## bundle.getNameForUid ## bundle.getNameForUid<sup>8+</sup>
getNameForUid(uid: number): Promise\<string> getNameForUid(uid: number): Promise\<string>
...@@ -1104,7 +1107,7 @@ bundle.getNameForUid(uid) ...@@ -1104,7 +1107,7 @@ bundle.getNameForUid(uid)
}) })
``` ```
## bundle.getNameForUid ## bundle.getNameForUid<sup>8+</sup>
getNameForUid(uid: number, callback: AsyncCallback\<string>): void; getNameForUid(uid: number, callback: AsyncCallback\<string>): void;
...@@ -1135,12 +1138,20 @@ bundle.getNameForUid(uid, (err, data) => { ...@@ -1135,12 +1138,20 @@ bundle.getNameForUid(uid, (err, data) => {
``` ```
## bundle.getAbilityIcon ## bundle.getAbilityIcon<sup>8+</sup>
function getAbilityIcon(bundleName: string, abilityName: string): Promise\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)>; getAbilityIcon(bundleName: string, abilityName: string): Promise\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)>;
以异步方法通过bundleName和abilityName获取对应Icon的[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md),使用Promise形式返回结果。 以异步方法通过bundleName和abilityName获取对应Icon的[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md),使用Promise形式返回结果。
**需要权限:**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO
**系统能力:**
SystemCapability.BundleManager.BundleFramework
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 名称 | 类型 | 必填 | 描述 |
...@@ -1166,12 +1177,20 @@ bundle.getAbilityIcon(bundleName, abilityName) ...@@ -1166,12 +1177,20 @@ bundle.getAbilityIcon(bundleName, abilityName)
}) })
``` ```
## bundle.getAbilityIcon ## bundle.getAbilityIcon<sup>8+</sup>
function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)>): void; getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md)>): void;
以异步方法通过bundleName和abilityName获取对应的[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md),使用callback形式返回结果。 以异步方法通过bundleName和abilityName获取对应的[PixelMap](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-image.md),使用callback形式返回结果。
**需要权限:**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO
**系统能力:**
SystemCapability.BundleManager.BundleFramework
**参数:** **参数:**
| 名称 | 类型 | 必填 | 描述 | | 名称 | 类型 | 必填 | 描述 |
...@@ -1195,9 +1214,9 @@ bundle.getAbilityIcon(bundleName, abilityName, (err, data) => { ...@@ -1195,9 +1214,9 @@ bundle.getAbilityIcon(bundleName, abilityName, (err, data) => {
``` ```
## bundle.queryExtensionAbilityInfosByWant ## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
function queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId?: number): Promise<Array\<ExtensionAbilityInfo>> queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId?: number): Promise<Array\<ExtensionAbilityInfo>>
以异步方法根据给定的意图获取ExtensionAbility信息,使用Promise形式返回结果。 以异步方法根据给定的意图获取ExtensionAbility信息,使用Promise形式返回结果。
...@@ -1242,12 +1261,16 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, userId) ...@@ -1242,12 +1261,16 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, userId)
## bundle.queryExtensionAbilityInfosByWant ## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
function queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, userId: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void
以异步方法根据给定的意图获取ExtensionAbility信息,使用callback形式返回结果。 以异步方法根据给定的意图获取ExtensionAbility信息,使用callback形式返回结果。
**需要权限:**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO
**系统能力:** **系统能力:**
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
...@@ -1279,12 +1302,16 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, userId, (err, data ...@@ -1279,12 +1302,16 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, userId, (err, data
}) })
``` ```
## bundle.queryExtensionAbilityInfosByWant ## bundle.queryExtensionAbilityInfosByWant<sup>9+</sup>
function queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void; queryExtensionAbilityInfosByWant(want: Want, extensionFlags: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void;
以异步方法根据给定的意图获取ExtensionAbility信息,使用callback形式返回结果。 以异步方法根据给定的意图获取ExtensionAbility信息,使用callback形式返回结果。
**需要权限:**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO
**系统能力:** **系统能力:**
SystemCapability.BundleManager.BundleFramework SystemCapability.BundleManager.BundleFramework
...@@ -1314,7 +1341,6 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => { ...@@ -1314,7 +1341,6 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
}) })
``` ```
## ElementName ## ElementName
**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework
...@@ -1333,7 +1359,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => { ...@@ -1333,7 +1359,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
| 名称 | 读写属性 | 类型 | 必填 | 描述 | | 名称 | 读写属性 | 类型 | 必填 | 描述 |
| ------------- | -------- | ---------------- | ---- | ------------------------------------------------------------ | | ------------- | -------- | ---------------- | ---- | ------------------------------------------------------------ |
| status | 只读 | InstallErrorCode | 是 | 安装结果code<br/>SUCCESS = 0<br/>STATUS_INSTALL_FAILURE = 1<br/>STATUS_INSTALL_FAILURE_ABORTED = 2,<br/>STATUS_INSTALL_FAILURE_INVALID = 3<br/>STATUS_INSTALL_FAILURE_CONFLICT = 4<br/>STATUS_INSTALL_FAILURE_STORAGE = 5<br/>STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6<br/>STATUS_UNINSTALL_FAILURE = 7<br>STATUS_UNINSTALL_FAILURE_BLOCKED = 8<br/>STATUS_UNINSTALL_FAILURE_ABORTED = 9<br/>STATUS_UNINSTALL_FAILURE_CONFLICT = 10<br/>STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B<br/>STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C<br/>STATUS_RECOVER_FAILURE_INVALID = 0x0D<br/>STATUS_ABILITY_NOT_FOUND = 0x40<br/>STATUS_BMS_SERVICE_ERROR = 0x41<br/>STATUS_FAILED_NO_SPACE_LEFT = 0x42<br/>STATUS_GRANT_REQUEST_PERMISSIONS_FAILED = 0x43<br/>STATUS_INSTALL_PERMISSION_DENIED = 0x44<br/>STATUS_UNINSTALL_PERMISSION_DENIED = 0x45 | | status | 只读 | InstallErrorCode | 是 | 安装结果code<br/>SUCCESS = 0<br/>STATUS_INSTALL_FAILURE = 1<br/>STATUS_INSTALL_FAILURE_ABORTED = 2,<br/>STATUS_INSTALL_FAILURE_INVALID = 3<br/>STATUS_INSTALL_FAILURE_CONFLICT = 4<br/>STATUS_INSTALL_FAILURE_STORAGE = 5<br/>STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6<br/>STATUS_UNINSTALL_FAILURE = 7<br>STATUS_UNINSTALL_FAILURE_BLOCKED = 8<br/>STATUS_UNINSTALL_FAILURE_ABORTED = 9<br/>STATUS_UNINSTALL_FAILURE_CONFLICT = 10<br/>STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B<br/>STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C<br/>STATUS_RECOVER_FAILURE_INVALID<sup>8+</sup> = 0x0D<br/>STATUS_ABILITY_NOT_FOUND = 0x40<br/>STATUS_BMS_SERVICE_ERROR = 0x41<br/>STATUS_FAILED_NO_SPACE_LEFT<sup>8+</sup> = 0x42<br/>STATUS_GRANT_REQUEST_PERMISSIONS_FAILED<sup>8+</sup> = 0x43<br/>STATUS_INSTALL_PERMISSION_DENIED<sup>8+</sup> = 0x44<br/>STATUS_UNINSTALL_PERMISSION_DENIED<sup>8+</sup> = 0x45 |
## BundleFlag ## BundleFlag
...@@ -1349,12 +1375,12 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => { ...@@ -1349,12 +1375,12 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
| GET_ABILITY_INFO_WITH_APPLICATION | 0x00000004 | 获取包括应用的Ability信息 | | GET_ABILITY_INFO_WITH_APPLICATION | 0x00000004 | 获取包括应用的Ability信息 |
| GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000008 | 获取包括权限的应用信息 | | GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000008 | 获取包括权限的应用信息 |
| GET_BUNDLE_WITH_REQUESTED_PERMISSION | 0x00000010 | 获取包括所需权限的包信息 | | GET_BUNDLE_WITH_REQUESTED_PERMISSION | 0x00000010 | 获取包括所需权限的包信息 |
| GET_ABILITY_INFO_WITH_METADATA | 0x00000020 | 获取ability的元数据信息 | | GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | 获取ability的元数据信息 |
| GET_BUNDLE_WITH_EXTENSION_ABILITY | 0x00000020 | 获取包括Ability信息的扩展包信息 | | GET_BUNDLE_WITH_EXTENSION_ABILITY<sup>9+</sup> | 0x00000020 | 获取包括Ability信息的扩展包信息 |
| GET_APPLICATION_INFO_WITH_METADATA | 0x00000040 | 获取应用的元数据信息 | | GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | 获取应用的元数据信息 |
| GET_ABILITY_INFO_SYSTEMAPP_ONLY | 0x00000080 | 获取仅包括系统应用的ability信息 | | GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | 获取仅包括系统应用的ability信息 |
| GET_ABILITY_INFO_WITH_DISABLE | 0x00000100 | 获取包括被禁用的ability信息 | | GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | 获取包括被禁用的ability信息 |
| GET_APPLICATION_INFO_WITH_DISABLE | 0x00000200 | 获取包括被禁用的应用信息 | | GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | 获取包括被禁用的应用信息 |
| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | 获取应用所有的信息 | | GET_ALL_APPLICATION_INFO | 0xFFFF0000 | 获取应用所有的信息 |
## BundleOptions ## BundleOptions
...@@ -1397,8 +1423,8 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => { ...@@ -1397,8 +1423,8 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
| isSilentInstallation | string | 是 | 否 | 是否通过静默安装 | | isSilentInstallation | string | 是 | 否 | 是否通过静默安装 |
| minCompatibleVersionCode | number | 是 | 否 | 分布式场景下的应用包兼容的最低版本 | | minCompatibleVersionCode | number | 是 | 否 | 分布式场景下的应用包兼容的最低版本 |
| entryInstallationFree | boolean | 是 | 否 | Entry是否支持免安装 | | entryInstallationFree | boolean | 是 | 否 | Entry是否支持免安装 |
| reqPermissionStates | Array\<number> | 是 | 否 | 申请权限的授予状态 | | reqPermissionStates<sup>8+</sup> | Array\<number> | 是 | 否 | 申请权限的授予状态 |
| extensionAbilityInfo | Array\<ExtensionAbilityInfo> | 是 | 否 | ability的可扩展信息 | | extensionAbilityInfo<sup>9+</sup> | Array\<ExtensionAbilityInfo> | 是 | 否 | ability的可扩展信息 |
## ApplicationInfo ## ApplicationInfo
...@@ -1424,13 +1450,13 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => { ...@@ -1424,13 +1450,13 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
| moduleInfos | Array\<ModuleInfo> | 是 | 否 | 应用程序的模块信息 | | moduleInfos | Array\<ModuleInfo> | 是 | 否 | 应用程序的模块信息 |
| entryDir | string | 是 | 否 | 应用程序的文件保存路径 | | entryDir | string | 是 | 否 | 应用程序的文件保存路径 |
| customizeData | Map<string, Array\<CustomizeData>> | 是 | 是 | 应用程序的自定义数据 | | customizeData | Map<string, Array\<CustomizeData>> | 是 | 是 | 应用程序的自定义数据 |
| codePath | string | 是 | 否 | 应用程序的安装目录 | | codePath<sup>8+</sup> | string | 是 | 否 | 应用程序的安装目录 |
| metaData | Map<string, Array\<CustomizeData>> | 是 | 否 | 应用程序的自定义元信息 | | metaData<sup>8+</sup> | Map<string, Array\<CustomizeData>> | 是 | 否 | 应用程序的自定义元信息 |
| metaData | Map<string, Array\<Metadata>> | 是 | 否 | 应用程序的元信息 | | metaData<sup>9+</sup> | Map<string, Array\<Metadata>> | 是 | 否 | 应用程序的元信息 |
| removable | boolean | 是 | 否 | 应用程序是否可以被移除 | | removable<sup>8+</sup> | boolean | 是 | 否 | 应用程序是否可以被移除 |
| accessTokenId | number | 是 | 否 | 应用程序的accessTokenId | | accessTokenId<sup>8+</sup> | number | 是 | 否 | 应用程序的accessTokenId |
| uid | number | 是 | 否 | 应用程序的uid | | uid<sup>8+</sup> | number | 是 | 否 | 应用程序的uid |
| entityType | string | 是 | 否 | 应用程序的实体类型 | | entityType<sup>9+</sup> | string | 是 | 否 | 应用程序的实体类型 |
## ModuleInfo ## ModuleInfo
...@@ -1453,7 +1479,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => { ...@@ -1453,7 +1479,7 @@ bundle.queryExtensionAbilityInfosByWant(want, extensionFlags, (err, data) => {
| ----- | ------ | ---- | ---- | ---------------- | | ----- | ------ | ---- | ---- | ---------------- |
| name | string | 是 | 是 | 自定义元数据名称 | | name | string | 是 | 是 | 自定义元数据名称 |
| value | string | 是 | 是 | 自定义元数据值 | | value | string | 是 | 是 | 自定义元数据值 |
| extra | string | 是 | 是 | 自定义资源 | | extra<sup>8+</sup> | string | 是 | 是 | 自定义资源 |
## HapModuleInfo ## HapModuleInfo
...@@ -1479,9 +1505,9 @@ Hap模块信息 ...@@ -1479,9 +1505,9 @@ Hap模块信息
| moduleName | string | 是 | 否 | 模块名 | | moduleName | string | 是 | 否 | 模块名 |
| mainAbilityName | string | 是 | 否 | 入口Ability名称 | | mainAbilityName | string | 是 | 否 | 入口Ability名称 |
| installationFree | boolean | 是 | 否 | 是否支持免安装 | | installationFree | boolean | 是 | 否 | 是否支持免安装 |
| mainElementName | string | 是 | 否 | 入口ability信息 | | mainElementName<sup>8+</sup> | string | 是 | 否 | 入口ability信息 |
| extensionAbilityInfo | Array\<ExtensionAbilityInfo> | 是 | 否 | extensionAbility信息 | | extensionAbilityInfo<sup>9+</sup> | Array\<ExtensionAbilityInfo> | 是 | 否 | extensionAbility信息 |
| metadata | Array\<Metadata> | 是 | 否 | Ability的元信息 | | metadata<sup>9+</sup> | Array\<Metadata> | 是 | 否 | Ability的元信息 |
## ReqPermissionDetail ## ReqPermissionDetail
...@@ -1540,9 +1566,9 @@ Ability信息 ...@@ -1540,9 +1566,9 @@ Ability信息
| uri | string | 是 | 否 | 获取Ability的统一资源标识符(URI) | | uri | string | 是 | 否 | 获取Ability的统一资源标识符(URI) |
| labelId | number | 是 | 否 | Ability的标签id | | labelId | number | 是 | 否 | Ability的标签id |
| subType | AbilitySubType | 是 | 否 | Ability中枚举使用的模板的子类型 | | subType | AbilitySubType | 是 | 否 | Ability中枚举使用的模板的子类型 |
| metaData | Array\<CustomizeData> | 是 | 否 | ability的自定义信息 | | metaData<sup>8+</sup> | Array\<CustomizeData> | 是 | 否 | ability的自定义信息 |
| metaData | Array\<Metadata> | 是 | 否 | ability的元信息 | | metaData<sup>9+</sup> | Array\<Metadata> | 是 | 否 | ability的元信息 |
| enabled | boolean | 是 | 否 | ability是否可用 | | enabled<sup>8+</sup> | boolean | 是 | 否 | ability是否可用 |
## AbilityType ## AbilityType
...@@ -1593,7 +1619,7 @@ Ability的子类型 ...@@ -1593,7 +1619,7 @@ Ability的子类型
| CA | 1 | Ability子类型是带有 UI 的服务 | | CA | 1 | Ability子类型是带有 UI 的服务 |
## ExtensionAbilityType ## ExtensionAbilityType<sup>9+</sup>
ExtensionAbility的类型 ExtensionAbility的类型
...@@ -1601,18 +1627,18 @@ ExtensionAbility的类型 ...@@ -1601,18 +1627,18 @@ ExtensionAbility的类型
| 名称 | 类型 | 说明 | | 名称 | 类型 | 说明 |
| -------------------- | ---- | ----------------------------- | | -------------------- | ---- | ----------------------------- |
| FORM | 0 | ExtensionAbility的类型包括卡片 | | FORM<sup>9+</sup> | 0 | ExtensionAbility的类型包括卡片 |
| WORK_SCHEDULER | 1 | ExtensionAbility的类型包括行程安排 | | WORK_SCHEDULER<sup>9+</sup> | 1 | ExtensionAbility的类型包括行程安排 |
| INPUT_METHOD | 2 | ExtensionAbility的类型包括输入法 | | INPUT_METHOD<sup>9+</sup> | 2 | ExtensionAbility的类型包括输入法 |
| SERVICE | 3 | ExtensionAbility的类型包括服务 | | SERVICE<sup>9+</sup> | 3 | ExtensionAbility的类型包括服务 |
| ACCESSIBILITY | 4 | ExtensionAbility的类型包括无障碍 | | ACCESSIBILITY<sup>9+</sup> | 4 | ExtensionAbility的类型包括无障碍 |
| DATA_SHARE | 5 | ExtensionAbility的类型包括数据共享 | | DATA_SHARE<sup>9+</sup> | 5 | ExtensionAbility的类型包括数据共享 |
| FILE_SHARE | 6 | ExtensionAbility的类型包括文件共享 | | FILE_SHARE<sup>9+</sup> | 6 | ExtensionAbility的类型包括文件共享 |
| STATIC_SUBSCRIBER | 7 | ExtensionAbility的类型包括订阅者 | | STATIC_SUBSCRIBER<sup>9+</sup> | 7 | ExtensionAbility的类型包括订阅者 |
| WALLPAPER | 8 | ExtensionAbility的类型包括墙纸 | | WALLPAPER<sup>9+</sup> | 8 | ExtensionAbility的类型包括墙纸 |
| UNSPECIFIED | 9 | ExtensionAbility未指定类型 | | UNSPECIFIED<sup>9+</sup> | 9 | ExtensionAbility未指定类型 |
## ExtensionFlag ## ExtensionFlag<sup>9+</sup>
扩展标志 扩展标志
...@@ -1620,13 +1646,13 @@ ExtensionAbility的类型 ...@@ -1620,13 +1646,13 @@ ExtensionAbility的类型
| 名称 | 默认值 | 说明 | | 名称 | 默认值 | 说明 |
| ------ | ------ | ------ | | ------ | ------ | ------ |
| GET_EXTENSION_INFO_DEFAULT | 0x00000000 | 获取默认的extensionAbilityInfo | | GET_EXTENSION_INFO_DEFAULT<sup>9+</sup> | 0x00000000 | 获取默认的extensionAbilityInfo |
| GET_EXTENSION_INFO_WITH_PERMISSION | 0x00000002 | 获取携带权限信息的extensionAbilityInfo | | GET_EXTENSION_INFO_WITH_PERMISSION<sup>9+</sup> | 0x00000002 | 获取携带权限信息的extensionAbilityInfo |
| GET_EXTENSION_INFO_WITH_APPLICATION | 0x00000004 | 获取携带应用信息的extensionAbilityInfo | | GET_EXTENSION_INFO_WITH_APPLICATION<sup>9+</sup> | 0x00000004 | 获取携带应用信息的extensionAbilityInfo |
| GET_EXTENSION_INFO_WITH_METADATA | 0x00000020 | 获取携带元数据信息的extensionAbilityInfo | | GET_EXTENSION_INFO_WITH_METADATA<sup>9+</sup> | 0x00000020 | 获取携带元数据信息的extensionAbilityInfo |
## ExtensionAbilityInfo ## ExtensionAbilityInfo<sup>9+</sup>
ExtensionAbility信息 ExtensionAbility信息
...@@ -1634,23 +1660,23 @@ ExtensionAbility信息 ...@@ -1634,23 +1660,23 @@ ExtensionAbility信息
| 名称 | 类型 | 可读 | 可写 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ------ | ------ | ------ | ------ | ------ | | ------ | ------ | ------ | ------ | ------ |
| bundleName | string | 是 | 否 | 应用包名 | | bundleName<sup>9+</sup> | string | 是 | 否 | 应用包名 |
| moduleName | string | 是 | 否 | ExtensionAbility所属的HAP包的名称 | | moduleName<sup>9+</sup> | string | 是 | 否 | ExtensionAbility所属的HAP包的名称 |
| name | string | 是 | 否 | ExtensionAbility名称 | | name<sup>9+</sup> | string | 是 | 否 | ExtensionAbility名称 |
| labelId | number | 是 | 否 | ExtensionAbility的标签id | | labelId<sup>9+</sup> | number | 是 | 否 | ExtensionAbility的标签id |
| descriptionId | number | 是 | 否 | ExtensionAbility的描述id | | descriptionId<sup>9+</sup> | number | 是 | 否 | ExtensionAbility的描述id |
| iconId | number | 是 | 否 | ExtensionAbility的图标id | | iconId<sup>9+</sup> | number | 是 | 否 | ExtensionAbility的图标id |
| isVisible | boolean | 是 | 否 | 判断ExtensionAbility是否可以被其他应用调用 | | isVisible<sup>9+</sup> | boolean | 是 | 否 | 判断ExtensionAbility是否可以被其他应用调用 |
| extensionAbilityType | bundle.ExtensionAbilityType | 是 | 否 | ExtensionAbility类型 | | extensionAbilityType<sup>9+</sup> | bundle.ExtensionAbilityType | 是 | 否 | ExtensionAbility类型 |
| permissions | Array\<string> | 是 | 否 | 被其他应用ExtensionAbility调用时需要申请的权限集合 | | permissions<sup>9+</sup> | Array\<string> | 是 | 否 | 被其他应用ExtensionAbility调用时需要申请的权限集合 |
| applicationInfo | ApplicationInfo | 是 | 否 | 应用程序的配置信息 | | applicationInfo<sup>9+</sup> | ApplicationInfo | 是 | 否 | 应用程序的配置信息 |
| metaData | Array\<Metadata> | 是 | 否 | ExtensionAbility的元信息 | | metaData<sup>9+</sup> | Array\<Metadata> | 是 | 否 | ExtensionAbility的元信息 |
| enabled | boolean | 是 | 否 | ExtensionAbility是否可用 | | enabled<sup>9+</sup> | boolean | 是 | 否 | ExtensionAbility是否可用 |
| readPermission | string | 是 | 否 | 读取ExtensionAbility数据所需的权限 | | readPermission<sup>9+</sup> | string | 是 | 否 | 读取ExtensionAbility数据所需的权限 |
| writePermission | string | 是 | 否 | 向ExtensionAbility写数据所需的权限 | | writePermission<sup>9+</sup> | string | 是 | 否 | 向ExtensionAbility写数据所需的权限 |
## Metadata ## Metadata<sup>9+</sup>
元数据信息 元数据信息
...@@ -1658,6 +1684,6 @@ ExtensionAbility信息 ...@@ -1658,6 +1684,6 @@ ExtensionAbility信息
| 名称 | 类型 | 可读 | 可写 | 说明 | | 名称 | 类型 | 可读 | 可写 | 说明 |
| ----- | ------ | ---- | ---- | ---------------- | | ----- | ------ | ---- | ---- | ---------------- |
| name | string | 是 | 是 | 元数据名称 | | name<sup>9+</sup> | string | 是 | 是 | 元数据名称 |
| value | string | 是 | 是 | 元数据值 | | value<sup>9+</sup> | string | 是 | 是 | 元数据值 |
| resource | string | 是 | 是 | 元数据资源 | | resource<sup>9+</sup> | string | 是 | 是 | 元数据资源 |
\ No newline at end of file \ No newline at end of file
...@@ -11,23 +11,20 @@ import account_appAccount from '@ohos.account.appAccount'; ...@@ -11,23 +11,20 @@ import account_appAccount from '@ohos.account.appAccount';
``` ```
## 系统能力
SystemCapability.Account.AppAccount
## account_appAccount.createAppAccountManager ## account_appAccount.createAppAccountManager
createAppAccountManager(): AppAccountManager; createAppAccountManager(): AppAccountManager
应用帐号管理:获取应用帐号模块对象。 应用帐号管理:获取应用帐号模块对象。
- 返回值: **系统能力:** SystemCapability.Account.AppAccount
| 类型 | 说明 |
| -------- | -------- | **返回值:**
| AppAccountManager | 获取应用帐号模块的实例。 | | 类型 | 说明 |
| ----------------- | ------------------------ |
| AppAccountManager | 获取应用帐号模块的实例。 |
- 示例: **示例:**
``` ```
var appAccountManager = account.createAppAccountManager(); var appAccountManager = account.createAppAccountManager();
``` ```
...@@ -38,20 +35,20 @@ createAppAccountManager(): AppAccountManager; ...@@ -38,20 +35,20 @@ createAppAccountManager(): AppAccountManager;
### addAccount ### addAccount
addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void; addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
将此应用的帐号名添加到帐号管理服务中,使用callback回调异步返回结果。 将此应用的帐号名添加到帐号管理服务中,使用callback回调异步返回结果。
需要权限:无。 **系统能力:** SystemCapability.Account.AppAccount
- 参数: **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------- | ---- | ------------------------------------------ | | -------- | ------------------------- | ---- | ------------------------------------------ |
| name | string | 是 | 要添加的应用帐户的名称。 | | name | string | 是 | 要添加的应用帐户的名称。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 将此应用的帐号名添加到帐号管理服务的回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 将此应用的帐号名添加到帐号管理服务的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -62,21 +59,21 @@ addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void; ...@@ -62,21 +59,21 @@ addAccount(name: string, callback: AsyncCallback&lt;void&gt;): void;
### addAccount ### addAccount
addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;): void; addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;): void
将此应用程序的帐号名和额外信息添加到帐号管理服务中,使用callback回调异步返回结果。 将此应用程序的帐号名和额外信息添加到帐号管理服务中,使用callback回调异步返回结果。
需要权限:无。 **系统能力:** SystemCapability.Account.AppAccount
- 参数: **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------- | ---- | ------------------------------------------------------------ | | --------- | ------------------------- | ---- | ------------------------------------------------------------ |
| name | string | 是 | 要添加的应用帐户的名称。 | | name | string | 是 | 要添加的应用帐户的名称。 |
| extraInfo | string | 是 | 要添加的应用帐户的额外信息(例如token等),额外的信息不能是应用帐号的敏感信息。 | | extraInfo | string | 是 | 要添加的应用帐户的额外信息(例如token等),额外的信息不能是应用帐号的敏感信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 将此应用程序的帐号名和额外信息添加到帐号管理服务中的回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 将此应用程序的帐号名和额外信息添加到帐号管理服务中的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -89,26 +86,26 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;) ...@@ -89,26 +86,26 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;)
### addAccount ### addAccount
addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;; addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;
将此应用的帐号名或额外信息添加到帐号管理服务中,使用Promise方式异步返回结果。 将此应用的帐号名或额外信息添加到帐号管理服务中,使用Promise方式异步返回结果。
需要权限:无。 **系统能力:** SystemCapability.Account.AppAccount
- 参数: **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ------------------------------------------------------------ | | --------- | ------ | ---- | ------------------------------------------------------------ |
| name | string | 是 | 要添加的应用帐户的名称。 | | name | string | 是 | 要添加的应用帐户的名称。 |
| extraInfo | string | 是 | 要添加的应用帐户的额外信息,额外的信息不能是应用帐号的敏感信息。 | | extraInfo | string | 是 | 要添加的应用帐户的额外信息,额外的信息不能是应用帐号的敏感信息。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------- | ---------------------------------- | | ------------------- | ---------------------------------- |
| Promise&lt;void&gt; | romise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | romise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -121,22 +118,22 @@ addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;; ...@@ -121,22 +118,22 @@ addAccount(name: string, extraInfo?: string): Promise&lt;void&gt;;
### addAccountImplicitly<sup>8+</sup> ### addAccountImplicitly<sup>8+</sup>
addAccountImplicitly(owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void; addAccountImplicitly(owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void
根据指定的帐号所有者、鉴权类型和可选项,隐式地添加应用帐号,并使用callback回调异步返回结果。 根据指定的帐号所有者、鉴权类型和可选项,隐式地添加应用帐号,并使用callback回调异步返回结果。
需要权限:无。 **系统能力:** SystemCapability.Account.AppAccount
- 参数: **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | --- | -------------------------- | | -------- | --------------------- | ---- | ------------------------------ |
| owner | string | 是 | 要添加的应用帐户的所有者包名。 | | owner | string | 是 | 要添加的应用帐户的所有者包名。 |
| authType | string | 是 | 要添加的应用帐户的鉴权类型。 | | authType | string | 是 | 要添加的应用帐户的鉴权类型。 |
| options | {[key: string]: any} | 是 | 鉴权所需要的可选项。 | | options | {[key: string]: any} | 是 | 鉴权所需要的可选项。 |
| callback | AuthenticatorCallback | 是 | 认证器回调,用于返回鉴权结果。 | | callback | AuthenticatorCallback | 是 | 认证器回调,用于返回鉴权结果。 |
- 示例: **示例:**
``` ```
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
...@@ -162,18 +159,20 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a ...@@ -162,18 +159,20 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a
### deleteAccount ### deleteAccount
deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void; deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void
从帐号管理服务中删除应用帐号,使用callback回调异步返回结果。 从帐号管理服务中删除应用帐号,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ------------------- | ---- | ---------------------------------- |
| name | string | 是 | 要删除的应用帐户的名称。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 帐号管理服务中删除应用帐号的回调。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------- |
| name | string | 是 | 要删除的应用帐户的名称。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 帐号管理服务中删除应用帐号的回调。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -184,23 +183,25 @@ deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void; ...@@ -184,23 +183,25 @@ deleteAccount(name: string, callback: AsyncCallback&lt;void&gt;): void;
### deleteAccount ### deleteAccount
deleteAccount(name: string): Promise&lt;void&gt;; deleteAccount(name: string): Promise&lt;void&gt;
从帐号管理服务中删除应用帐号,使用Promise方式异步返回结果。 从帐号管理服务中删除应用帐号,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------------ | | ------ | ------ | ---- | ------------------------ |
| name | string | 是 | 要删除的应用帐户的名称。 | | name | string | 是 | 要删除的应用帐户的名称。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------ | :---------------------------------- | | :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -213,19 +214,21 @@ deleteAccount(name: string): Promise&lt;void&gt;; ...@@ -213,19 +214,21 @@ deleteAccount(name: string): Promise&lt;void&gt;;
### disableAppAccess ### disableAppAccess
disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;void&gt;): void; disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;void&gt;): void
禁止指定第三方应用帐户的名称访问指定包名称的第三方应用,使用callback回调异步返回结果。 禁止指定第三方应用帐户的名称访问指定包名称的第三方应用,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ---------- | ------------------- | ---- | ------------------------------------------------------------ |
| name | string | 是 | 要禁用访问的第三方应用帐户的名称。 |
| bundleName | string | 是 | 第三方应用的包名。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 禁止指定第三方应用帐户的名称访问指定包名称的第三方应用的回调。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------------------------------------------------------ |
| name | string | 是 | 要禁用访问的第三方应用帐户的名称。 |
| bundleName | string | 是 | 第三方应用的包名。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 禁止指定第三方应用帐户的名称访问指定包名称的第三方应用的回调。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -236,24 +239,26 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;vo ...@@ -236,24 +239,26 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;vo
### disableAppAccess ### disableAppAccess
disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;; disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
禁止指定第三方应用帐户的名称访问指定包名称的第三方应用,使用Promise方式异步返回结果。 禁止指定第三方应用帐户的名称访问指定包名称的第三方应用,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ---------------------------------- | | ---------- | ------ | ---- | ---------------------------------- |
| name | string | 是 | 要禁用访问的第三方应用帐户的名称。 | | name | string | 是 | 要禁用访问的第三方应用帐户的名称。 |
| bundleName | string | 是 | 第三方应用的包名。 | | bundleName | string | 是 | 第三方应用的包名。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------ | :---------------------------------- | | :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -266,19 +271,21 @@ disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;; ...@@ -266,19 +271,21 @@ disableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;;
### enableAppAccess ### enableAppAccess
enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;void&gt;): void; enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;void&gt;): void
允许指定第三方应用帐户的名称访问指定包名称的第三方应用,使用callback回调异步返回结果。 允许指定第三方应用帐户的名称访问指定包名称的第三方应用,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ---------- | ------------------- | ---- | ------------------------------------------------------------ |
| name | string | 是 | 应用帐号名称。 |
| bundleName | string | 是 | 第三方应用的包名。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 允许指定第三方应用帐户的名称访问指定包名称的第三方应用的回调。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------------------------------------------------------ |
| name | string | 是 | 应用帐号名称。 |
| bundleName | string | 是 | 第三方应用的包名。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 允许指定第三方应用帐户的名称访问指定包名称的第三方应用的回调。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -289,24 +296,26 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;voi ...@@ -289,24 +296,26 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback&lt;voi
### enableAppAccess ### enableAppAccess
enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;; enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;
允许指定第三方应用帐户的名称访问指定包名称的第三方应用,使用Promise方式异步返回结果。 允许指定第三方应用帐户的名称访问指定包名称的第三方应用,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ------------------ | | ---------- | ------ | ---- | ------------------ |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| bundleName | string | 是 | 第三方应用的包名。 | | bundleName | string | 是 | 第三方应用的包名。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------ | :---------------------------------- | | :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
app_account_instance.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => { app_account_instance.enableAppAccess("ZhangSan", "com.example.ohos.accountjsdemo").then(() => {
...@@ -318,20 +327,22 @@ enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;; ...@@ -318,20 +327,22 @@ enableAppAccess(name: string, bundleName: string): Promise&lt;void&gt;;
### checkAppAccountSyncEnable ### checkAppAccountSyncEnable
checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;): void; checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;): void
检查指定应用帐号是否允许应用数据同步,使用callback回调异步返回结果。 检查指定应用帐号是否允许应用数据同步,使用callback回调异步返回结果。
需要权限:ohos.permission.DISTRIBUTED_DATASYNC,系统应用可用。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC,仅系统应用可用。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ---------------------- | ---- | -------------------------------------------- |
| name | string | 是 | 应用帐号名称。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 检查指定应用帐号是否允许应用数据同步的回调。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | -------------------------------------------- |
| name | string | 是 | 应用帐号名称。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 检查指定应用帐号是否允许应用数据同步的回调。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -343,25 +354,27 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;): ...@@ -343,25 +354,27 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback&lt;boolean&gt;):
### checkAppAccountSyncEnable ### checkAppAccountSyncEnable
checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt;; checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt;
检查指定应用帐号是否允许应用数据同步,使用Promise方式异步返回结果。 检查指定应用帐号是否允许应用数据同步,使用Promise方式异步返回结果。
需要权限:ohos.permission.DISTRIBUTED_DATASYNC,系统应用可用。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC,仅系统应用可用。
**系统能力:** SystemCapability.Account.AppAccount
- 参数: **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------- | | ------ | ------ | ---- | -------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :--------------- | :---------------------------------- | | :--------------------- | :---------------------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -374,20 +387,22 @@ checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt;; ...@@ -374,20 +387,22 @@ checkAppAccountSyncEnable(name: string): Promise&lt;boolean&gt;;
### setAccountCredential ### setAccountCredential
setAccountCredential(name: string, credentialType: string, credential: string,callback: AsyncCallback&lt;void&gt;): void; setAccountCredential(name: string, credentialType: string, credential: string,callback: AsyncCallback&lt;void&gt;): void
设置此应用程序帐号的凭据,使用callback回调异步返回结果。 设置此应用程序帐号的凭据,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------------- | ------------------- | ---- | ---------------------------- |
| name | string | 是 | 应用程序帐户的名称。 |
| credentialType | string | 是 | 要设置的凭据的类型。 |
| credential | string | 是 | 要设置的凭据。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置此应用帐号的凭据的回调。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------------------------- | ---- | ---------------------------- |
| name | string | 是 | 应用程序帐户的名称。 |
| credentialType | string | 是 | 要设置的凭据的类型。 |
| credential | string | 是 | 要设置的凭据。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置此应用帐号的凭据的回调。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -398,25 +413,27 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca ...@@ -398,25 +413,27 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca
### setAccountCredential ### setAccountCredential
setAccountCredential(name: string, credentialType: string, credential: string): Promise&lt;void&gt;; setAccountCredential(name: string, credentialType: string, credential: string): Promise&lt;void&gt;
设置此应用程序帐号的凭据,使用Promise方式异步返回结果。 设置此应用程序帐号的凭据,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | -------------------- | | -------------- | ------ | ---- | -------------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| credentialType | string | 是 | 要设置的凭据的类型。 | | credentialType | string | 是 | 要设置的凭据的类型。 |
| credential | string | 是 | 要设置的凭据。 | | credential | string | 是 | 要设置的凭据。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------ | :---------------------------------- | | :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -429,19 +446,21 @@ setAccountCredential(name: string, credentialType: string, credential: string): ...@@ -429,19 +446,21 @@ setAccountCredential(name: string, credentialType: string, credential: string):
### setAccountExtraInfo ### setAccountExtraInfo
setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;): void; setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt;void&gt;): void
设置此应用程序帐号的额外信息,使用callback回调异步返回结果。 设置此应用程序帐号的额外信息,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------- | ---- | -------------------------------- | | --------- | ------------------------- | ---- | -------------------------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| extraInfo | string | 是 | 要设置的额外信息。 | | extraInfo | string | 是 | 要设置的额外信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置此应用帐号的额外信息的回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 设置此应用帐号的额外信息的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -452,24 +471,26 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt; ...@@ -452,24 +471,26 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback&lt;
### setAccountExtraInfo ### setAccountExtraInfo
setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt;; setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt;
设置此应用程序帐号的额外信息,使用Promise方式异步返回结果。 设置此应用程序帐号的额外信息,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| --------- | ------ | ---- | ------------------ |
| name | string | 是 | 应用帐户的名称。 |
| extraInfo | string | 是 | 要设置的额外信息。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------ | ---- | ------------------ |
| name | string | 是 | 应用帐户的名称。 |
| extraInfo | string | 是 | 要设置的额外信息。 |
| 类型 | 说明 | **返回值:**
| :------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -482,21 +503,23 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt;; ...@@ -482,21 +503,23 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise&lt;void&gt;;
### setAppAccountSyncEnable ### setAppAccountSyncEnable
setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback&lt;void&gt;): void; setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback&lt;void&gt;): void
设置指定的应用程序帐号是否允许应用程序数据同步,使用callback回调异步返回结果。 设置指定的应用程序帐号是否允许应用程序数据同步,使用callback回调异步返回结果。
需要权限:ohos.permission.DISTRIBUTED_DATASYNC,系统应用可用。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC,仅系统应用可用。
**系统能力:** SystemCapability.Account.AppAccount
- 参数: **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------- | ---- | -------------------------------------------------- | | -------- | ------------------------- | ---- | -------------------------------------------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| isEnable | boolean | 是 | 是否允许应用数据同步。 | | isEnable | boolean | 是 | 是否允许应用数据同步。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置指定的应用帐号是否允许应用程序数据同步的回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 设置指定的应用帐号是否允许应用程序数据同步的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -507,26 +530,28 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback ...@@ -507,26 +530,28 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback
### setAppAccountSyncEnable ### setAppAccountSyncEnable
setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt;; setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt;
设置指定的应用程序帐号是否允许应用程序数据同步,使用Promise方式异步返回结果。 设置指定的应用程序帐号是否允许应用程序数据同步,使用Promise方式异步返回结果。
需要权限:ohos.permission.DISTRIBUTED_DATASYNC,系统应用可用。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC,仅系统应用可用。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ------- | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 |
| isEnable | boolean | 是 | 是否允许应用数据同步。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------- | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 |
| isEnable | boolean | 是 | 是否允许应用数据同步。 |
| 类型 | 说明 | **返回值:**
| :------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -539,20 +564,22 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt;; ...@@ -539,20 +564,22 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise&lt;void&gt;;
### setAssociatedData ### setAssociatedData
setAssociatedData(name: string, key: string, value: string, callback: AsyncCallback&lt;void&gt;): void; setAssociatedData(name: string, key: string, value: string, callback: AsyncCallback&lt;void&gt;): void
设置与此应用程序帐号关联的数据,使用callback回调异步返回结果。 设置与此应用程序帐号关联的数据,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------- | ---- | ---------------------------------- | | -------- | ------------------------- | ---- | ---------------------------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| key | string | 是 | 要设置的数据的键,密钥可以自定义。 | | key | string | 是 | 要设置的数据的键,密钥可以自定义。 |
| value | string | 是 | 要设置的数据的值。 | | value | string | 是 | 要设置的数据的值。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置与此应用帐号关联的数据的回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 设置与此应用帐号关联的数据的回调。 |
- 示例: **示例:**
``` ```
app_account_instance.setAssociatedData("ZhangSan", "k001", "v001", (err) => { app_account_instance.setAssociatedData("ZhangSan", "k001", "v001", (err) => {
...@@ -562,25 +589,27 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb ...@@ -562,25 +589,27 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb
### setAssociatedData ### setAssociatedData
setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;; setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;
设置与此应用程序帐号关联的数据,使用Promise方式异步返回结果。 设置与此应用程序帐号关联的数据,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ------ | ------ | ---- | ---------------------------------- |
| name | string | 是 | 应用帐户的名称。 |
| key | string | 是 | 要设置的数据的键,密钥可以自定义。 |
| value | string | 是 | 要设置的数据的值。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------------------------------- |
| name | string | 是 | 应用帐户的名称。 |
| key | string | 是 | 要设置的数据的键,密钥可以自定义。 |
| value | string | 是 | 要设置的数据的值。 |
| 类型 | 说明 | **返回值:**
| :------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -593,19 +622,21 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt; ...@@ -593,19 +622,21 @@ setAssociatedData(name: string, key: string, value: string): Promise&lt;void&gt;
### getAccountCredential ### getAccountCredential
getAccountCredential(name: string, credentialType: string, callback: AsyncCallback&lt;string&gt;): void; getAccountCredential(name: string, credentialType: string, callback: AsyncCallback&lt;string&gt;): void
获取此应用帐号的凭据,使用callback回调异步返回结果。 获取此应用帐号的凭据,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------------- | --------------------- | ---- | ---------------------------- | | -------------- | --------------------------- | ---- | ---------------------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| credentialType | string | 是 | 要获取的凭据的类型。 | | credentialType | string | 是 | 要获取的凭据的类型。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 获取此应用帐号的凭据的回调。 | | callback | AsyncCallback&lt;string&gt; | 是 | 获取此应用帐号的凭据的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -617,24 +648,26 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba ...@@ -617,24 +648,26 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba
### getAccountCredential ### getAccountCredential
getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt;; getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt;
获取此应用程序帐号的凭据,使用Promise方式异步返回结果。 获取此应用程序帐号的凭据,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------------- | ------ | ---- | -------------------- |
| name | string | 是 | 应用帐号名称。 |
| credentialType | string | 是 | 要获取的凭据的类型。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| -------------- | ------ | ---- | -------------------- |
| name | string | 是 | 应用帐号名称。 |
| credentialType | string | 是 | 要获取的凭据的类型。 |
| 类型 | 说明 | **返回值:**
| :-------------- | :---------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| :-------------------- | :---------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -647,18 +680,20 @@ getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt ...@@ -647,18 +680,20 @@ getAccountCredential(name: string, credentialType: string): Promise&lt;string&gt
### getAccountExtraInfo ### getAccountExtraInfo
getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void; getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void
获取此应用帐号的额外信息,使用callback回调异步返回结果。 获取此应用帐号的额外信息,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------------------- | | -------- | --------------------------- | ---- | -------------------------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 获取此应用帐号的额外信息的回调。 | | callback | AsyncCallback&lt;string&gt; | 是 | 获取此应用帐号的额外信息的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -670,23 +705,25 @@ getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void; ...@@ -670,23 +705,25 @@ getAccountExtraInfo(name: string, callback: AsyncCallback&lt;string&gt;): void;
### getAccountExtraInfo ### getAccountExtraInfo
getAccountExtraInfo(name: string): Promise&lt;string&gt;; getAccountExtraInfo(name: string): Promise&lt;string&gt;
获取此应用程序帐号的额外信息,使用Promise方式异步返回结果。 获取此应用程序帐号的额外信息,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ------ | ------ | ---- | -------------- |
| name | string | 是 | 应用帐号名称。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | -------------- |
| name | string | 是 | 应用帐号名称。 |
| 类型 | 说明 | **返回值:**
| :-------------- | :---------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| :-------------------- | :---------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -699,19 +736,21 @@ getAccountExtraInfo(name: string): Promise&lt;string&gt;; ...@@ -699,19 +736,21 @@ getAccountExtraInfo(name: string): Promise&lt;string&gt;;
### getAssociatedData ### getAssociatedData
getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&gt;): void; getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&gt;): void
获取与此应用程序帐号关联的数据,使用callback回调异步返回结果。 获取与此应用程序帐号关联的数据,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ---------------------------------- | | -------- | --------------------------- | ---- | ---------------------------------- |
| name | string | 是 | 应用帐号名称。 | | name | string | 是 | 应用帐号名称。 |
| key | string | 是 | 要获取的数据的key。 | | key | string | 是 | 要获取的数据的key。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 获取与此应用帐号关联的数据的回调。 | | callback | AsyncCallback&lt;string&gt; | 是 | 获取与此应用帐号关联的数据的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -723,24 +762,26 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&g ...@@ -723,24 +762,26 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback&lt;string&g
### getAssociatedData ### getAssociatedData
getAssociatedData(name: string, key: string): Promise&lt;string&gt;; getAssociatedData(name: string, key: string): Promise&lt;string&gt;
获取与此应用程序帐号关联的数据,使用Promise方式异步返回结果。 获取与此应用程序帐号关联的数据,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ------ | ------ | ---- | ------------------- |
| name | string | 是 | 应用帐号名称。 |
| key | string | 是 | 要获取的数据的key。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------------- |
| name | string | 是 | 应用帐号名称。 |
| key | string | 是 | 要获取的数据的key。 |
| 类型 | 说明 | **返回值:**
| :-------------- | :---------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| :-------------------- | :---------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -753,19 +794,21 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt;; ...@@ -753,19 +794,21 @@ getAssociatedData(name: string, key: string): Promise&lt;string&gt;;
### getAllAccessibleAccounts ### getAllAccessibleAccounts
getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void; getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
获取全部应用已授权帐号信息。 获取全部应用已授权帐号信息。
需要权限:ohos.permission.GET_ACCOUNTS_PRIVILEGED,系统应用可用。 **需要权限:** ohos.permission.GET_ACCOUNTS_PRIVILEGED,仅系统应用可用。
**系统能力:** SystemCapability.Account.AppAccount
- 参数: **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------ | ---- | ---------------- | | -------- | ------------------------------------------------ | ---- | ---------------- |
| callback | AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 应用帐号信息列表 | | callback | AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 应用帐号信息列表 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -777,19 +820,21 @@ getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;& ...@@ -777,19 +820,21 @@ getAllAccessibleAccounts(callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&
### getAllAccessibleAccounts ### getAllAccessibleAccounts
getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;; getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
获取全部应用已授权帐号信息。 获取全部应用已授权帐号信息。
需要权限:ohos.permission.GET_ACCOUNTS_PRIVILEGED,系统应用可用。 **需要权限:** ohos.permission.GET_ACCOUNTS_PRIVILEGED,仅系统应用可用。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 类型 | 说明 | **参数:**
| ------------------------------ | ----------------------------------- |
| Promise&lt;Array&lt;AppAccountInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| ------------------------------------------ | ----------------------------------- |
| Promise&lt;Array&lt;AppAccountInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -802,20 +847,22 @@ getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;; ...@@ -802,20 +847,22 @@ getAllAccessibleAccounts(): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;;
### getAllAccounts ### getAllAccounts
getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void; getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
获取指定应用全部帐号信息。 获取指定应用全部帐号信息。
需要权限:ohos.permission.GET_ACCOUNTS_PRIVILEGED,系统应用可用。 **需要权限:** ohos.permission.GET_ACCOUNTS_PRIVILEGED,仅系统应用可用。
**系统能力:** SystemCapability.Account.AppAccount
- 参数: **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------ | ---- | ---------------- | | -------- | ------------------------------------------------ | ---- | ---------------- |
| owner | string | 是 | 应用包名称 | | owner | string | 是 | 应用包名称 |
| callback | AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 应用帐号信息列表 | | callback | AsyncCallback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 应用帐号信息列表 |
- 示例: **示例:**
``` ```
const appAccountManager = account.createAppAccountManager(); const appAccountManager = account.createAppAccountManager();
...@@ -828,25 +875,27 @@ getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo ...@@ -828,25 +875,27 @@ getAllAccounts(owner: string, callback: AsyncCallback&lt;Array&lt;AppAccountInfo
### getAllAccounts ### getAllAccounts
getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;; getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;
获取指定应用全部帐号信息。 获取指定应用全部帐号信息。
需要权限:ohos.permission.GET_ACCOUNTS_PRIVILEGED,系统应用可用。 **需要权限:** ohos.permission.GET_ACCOUNTS_PRIVILEGED,仅系统应用可用。
**系统能力:** SystemCapability.Account.AppAccount
- 参数: **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ---------- | | ------ | ------ | ---- | ---------- |
| owner | string | 是 | 应用包名称 | | owner | string | 是 | 应用包名称 |
- 参数: **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------ | ----------------------------------- | | ------------------------------------------ | ----------------------------------- |
| Promise&lt;Array&lt;AppAccountInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;Array&lt;AppAccountInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -860,19 +909,21 @@ getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;; ...@@ -860,19 +909,21 @@ getAllAccounts(owner: string): Promise&lt;Array&lt;AppAccountInfo&gt;&gt;;
### on('change') ### on('change')
on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;AppAccountInfo&gt;&gt;): void; on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;AppAccountInfo&gt;&gt;): void
订阅指定帐号所有者的帐户变更事件,使用callback回调异步返回结果。 订阅指定帐号所有者的帐户变更事件,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | 'change' | 是 | 关于帐户更改事件,当帐户所有者更新帐户时,订阅者将收到通知。 |
| owners | Array&lt;string&gt; | 是 | 指示帐户的所有者。 |
| callback | Callback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 订阅指定帐号所有者的帐户变更事件的回调。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | 'change' | 是 | 关于帐户更改事件,当帐户所有者更新帐户时,订阅者将收到通知。 |
| owners | Array&lt;string&gt; | 是 | 指示帐户的所有者。 |
| callback | Callback&lt;Array&lt;AppAccountInfo&gt;&gt; | 是 | 订阅指定帐号所有者的帐户变更事件的回调。 |
**示例:**
``` ```
const appAccountManager = account.createAppAccountManager(); const appAccountManager = account.createAppAccountManager();
...@@ -889,18 +940,20 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A ...@@ -889,18 +940,20 @@ on(type: 'change', owners: Array&lt;string&gt;, callback: Callback&lt;Array&lt;A
### off('change') ### off('change')
off(type: 'change', callback?: Callback&lt;void&gt;): void; off(type: 'change', callback?: Callback<Array\<AppAccountInfo>>): void
取消订阅帐号事件,使用callback回调异步返回结果。 取消订阅帐号事件,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------ | | -------- | -------------------------------- | ---- | ------------------------ |
| type | 'change' | 是 | 关于帐户更改事件。 | | type | 'change' | 是 | 关于帐户更改事件。 |
| callback | Callback&lt;void&gt; | 否 | 取消订阅帐号事件的回调。 | | callback | Callback<Array\<AppAccountInfo>> | 否 | 取消订阅帐号事件的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account.createAppAccountManager(); const appAccountManager = account.createAppAccountManager();
...@@ -920,21 +973,23 @@ off(type: 'change', callback?: Callback&lt;void&gt;): void; ...@@ -920,21 +973,23 @@ off(type: 'change', callback?: Callback&lt;void&gt;): void;
### authenticate<sup>8+</sup> ### authenticate<sup>8+</sup>
authenticate(name: string, owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void; authenticate(name: string, owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void
鉴权应用帐户以获取OAuth令牌,使用callback回调异步返回结果。 鉴权应用帐户以获取OAuth令牌,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | --------------------- | ---- | --------------------------- |
| name | string | 是 | 要鉴权的应用帐户的名称。 |
| owner | string | 是 | 要鉴权的应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
| options | {[key: string]: any} | 是 | 鉴权所需的可选项。 |
| callback | AuthenticatorCallback | 是 | 认证器回调,用于返回鉴权结果。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------ |
| name | string | 是 | 要鉴权的应用帐户的名称。 |
| owner | string | 是 | 要鉴权的应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
| options | {[key: string]: any} | 是 | 鉴权所需的可选项。 |
| callback | AuthenticatorCallback | 是 | 认证器回调,用于返回鉴权结果。 |
**示例:**
``` ```
import featureAbility from '@ohos.ability.featureAbility'; import featureAbility from '@ohos.ability.featureAbility';
...@@ -960,20 +1015,22 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri ...@@ -960,20 +1015,22 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri
### getOAuthToken<sup>8+</sup> ### getOAuthToken<sup>8+</sup>
getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback&lt;string&gt;): void; getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback&lt;string&gt;): void
获取指定应用帐户和鉴权类型的OAuth令牌,使用callback回调异步返回结果。 获取指定应用帐户和鉴权类型的OAuth令牌,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | -------------------- | | -------- | --------------------------- | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 | | owner | string | 是 | 应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 查询结果的回调。 | | callback | AsyncCallback&lt;string&gt; | 是 | 查询结果的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -985,25 +1042,27 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall ...@@ -985,25 +1042,27 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall
### getOAuthToken<sup>8+</sup> ### getOAuthToken<sup>8+</sup>
getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&gt;; getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&gt;
获取指定应用帐户和鉴权类型的OAuth令牌,使用Promise方式异步返回结果。 获取指定应用帐户和鉴权类型的OAuth令牌,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ------ | ---- | -------------------- |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
- 参数: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
| 类型 | 说明 | **参数:**
| --------------------- | -------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| --------------------- | ----------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1016,20 +1075,22 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string& ...@@ -1016,20 +1075,22 @@ getOAuthToken(name: string, owner: string, authType: string): Promise&lt;string&
### setOAuthToken<sup>8+</sup> ### setOAuthToken<sup>8+</sup>
setOAuthToken(name: string, authType: string, token: string, callback: AsyncCallback&lt;void&gt;): void; setOAuthToken(name: string, authType: string, token: string, callback: AsyncCallback&lt;void&gt;): void
设置指定应用帐户和鉴权类型的OAuth令牌,使用callback回调异步返回结果。 设置指定应用帐户和鉴权类型的OAuth令牌,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------- | | -------- | ------------------------- | ---- | ---------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| token | string | 是 | OAuth令牌。 | | token | string | 是 | OAuth令牌。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置结果的回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 设置结果的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1040,25 +1101,27 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall ...@@ -1040,25 +1101,27 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall
### setOAuthToken<sup>8+</sup> ### setOAuthToken<sup>8+</sup>
setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt;; setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt;
设置指定应用帐户和鉴权类型的OAuth令牌,使用Promise方式异步返回结果。 设置指定应用帐户和鉴权类型的OAuth令牌,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ------ | ---- | ------------- |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| token | string | 是 | OAuth令牌。 |
- 参数: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------- |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| token | string | 是 | OAuth令牌。 |
| 类型 | 说明 | **参数:**
| ------------------- | -------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| ------------------- | ----------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1071,21 +1134,23 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt ...@@ -1071,21 +1134,23 @@ setOAuthToken(name: string, authType: string, token: string): Promise&lt;void&gt
### deleteOAuthToken<sup>8+</sup> ### deleteOAuthToken<sup>8+</sup>
deleteOAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback&lt;void&gt;): void; deleteOAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback&lt;void&gt;): void
删除指定应用帐户和鉴权类型的OAuth令牌,使用callback回调异步返回结果。 删除指定应用帐户和鉴权类型的OAuth令牌,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------ | | -------- | ------------------------- | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 | | owner | string | 是 | 应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| token | string | 是 | 要删除的OAuth令牌。 | | token | string | 是 | 要删除的OAuth令牌。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 删除结果的回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 删除结果的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1096,26 +1161,28 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c ...@@ -1096,26 +1161,28 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c
### deleteOAuthToken<sup>8+</sup> ### deleteOAuthToken<sup>8+</sup>
deleteOAuthToken(name: string, owner: string, authType: string, token: string): Promise&lt;void&gt;; deleteOAuthToken(name: string, owner: string, authType: string, token: string): Promise&lt;void&gt;
删除指定应用帐户和鉴权类型的OAuth令牌,使用Promise方式异步返回结果。 删除指定应用帐户和鉴权类型的OAuth令牌,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ------ | ---- | ------------------ |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
| token | string | 是 | 要删除的OAuth令牌。 |
- 参数: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| authType | string | 是 | 鉴权类型。 |
| token | string | 是 | 要删除的OAuth令牌。 |
| 类型 | 说明 | **参数:**
| ------------------------------ | --------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| ------------------- | ----------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1128,21 +1195,23 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string): ...@@ -1128,21 +1195,23 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string):
### setOAuthTokenVisibility<sup>8+</sup> ### setOAuthTokenVisibility<sup>8+</sup>
setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback&lt;void&gt;): void; setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback&lt;void&gt;): void
设置指定鉴权类型的OAuth令牌对特定应用的可见性,使用callback回调异步返回结果。 设置指定鉴权类型的OAuth令牌对特定应用的可见性,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------------------------- | ---- | ------------------- | | ---------- | ------------------------- | ---- | ------------------------ |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 被设置可见性的应用包名。| | bundleName | string | 是 | 被设置可见性的应用包名。 |
| isVisible | boolean | 是 | 是否可见。 | | isVisible | boolean | 是 | 是否可见。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 设置结果的回调。 | | callback | AsyncCallback&lt;void&gt; | 是 | 设置结果的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1153,26 +1222,28 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi ...@@ -1153,26 +1222,28 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
### setOAuthTokenVisibility<sup>8+</sup> ### setOAuthTokenVisibility<sup>8+</sup>
setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise&lt;void&gt;; setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise&lt;void&gt;
设置指定鉴权类型的OAuth令牌对特定应用的可见性,使用Promise方式异步返回结果。 设置指定鉴权类型的OAuth令牌对特定应用的可见性,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ---------- | ------------------------- | ---- | ------------------- |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 被设置可见性的应用包名。|
| isVisible | boolean | 是 | 是否可见。 |
- 参数: | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------- | ---- | ------------------------ |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 被设置可见性的应用包名。 |
| isVisible | boolean | 是 | 是否可见。 |
| 类型 | 说明 | **参数:**
| ------------------------------ | --------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| ------------------- | ----------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1186,20 +1257,22 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi ...@@ -1186,20 +1257,22 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi
### checkOAuthTokenVisibility<sup>8+</sup> ### checkOAuthTokenVisibility<sup>8+</sup>
checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback&lt;boolean&gt;): void; checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback&lt;boolean&gt;): void
检查指定鉴权类型的OAuth令牌对特定应用的可见性,使用callback回调异步返回结果。 检查指定鉴权类型的OAuth令牌对特定应用的可见性,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------- | ---- | ---------------------- | | ---------- | ---------------------------- | ---- | -------------------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 | | authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 用于检查可见性的应用包名。 | | bundleName | string | 是 | 用于检查可见性的应用包名。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 检查结果的回调。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 检查结果的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1211,25 +1284,27 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca ...@@ -1211,25 +1284,27 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca
### checkOAuthTokenVisibility<sup>8+</sup> ### checkOAuthTokenVisibility<sup>8+</sup>
checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise&lt;boolean&gt;; checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise&lt;boolean&gt;
检查指定鉴权类型的OAuth令牌对特定应用的可见性,使用Promise方式异步返回结果。 检查指定鉴权类型的OAuth令牌对特定应用的可见性,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ---------- | ------------------------- | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 用于检查可见性的应用包名。 |
- 参数: | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | -------------------------- |
| name | string | 是 | 应用帐户的名称。 |
| authType | string | 是 | 鉴权类型。 |
| bundleName | string | 是 | 用于检查可见性的应用包名。 |
| 类型 | 说明 | **参数:**
| ------------------------------ | ------------------------ |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: | 类型 | 说明 |
| ---------------------- | ----------------------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1242,19 +1317,21 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P ...@@ -1242,19 +1317,21 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P
### getAllOAuthTokens<sup>8+</sup> ### getAllOAuthTokens<sup>8+</sup>
getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&lt;OAuthTokenInfo&gt;&gt;): void; getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&lt;OAuthTokenInfo&gt;&gt;): void
获取指定应用对调用方全部可见的OAuth令牌,使用callback回调异步返回结果。 获取指定应用对调用方全部可见的OAuth令牌,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | ------------------- | | -------- | ------------------------------------------------ | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 | | owner | string | 是 | 应用帐户的所有者包名。 |
| callback | AsyncCallback&lt;Array&lt;OAuthTokenInfo&gt;&gt; | 是 | 查询结果的回调。 | | callback | AsyncCallback&lt;Array&lt;OAuthTokenInfo&gt;&gt; | 是 | 查询结果的回调。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1266,24 +1343,26 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array& ...@@ -1266,24 +1343,26 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback&lt;Array&
### getAllOAuthTokens<sup>8+</sup> ### getAllOAuthTokens<sup>8+</sup>
getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenInfo&gt;&gt;; getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenInfo&gt;&gt;
获取指定应用帐户对调用方可见的全部OAuth令牌,使用Promise方式异步返回结果。 获取指定应用帐户对调用方可见的全部OAuth令牌,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------- | | ------ | ------ | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 | | owner | string | 是 | 应用帐户的所有者包名。 |
- 参数: **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------ | ----------------------------------- | | ------------------------------------------ | ----------------------------------- |
| Promise&lt;Array&lt;OAuthTokenInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;Array&lt;OAuthTokenInfo&gt;&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1296,19 +1375,21 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn ...@@ -1296,19 +1375,21 @@ getAllOAuthTokens(name: string, owner: string): Promise&lt;Array&lt;OAuthTokenIn
### getOAuthList<sup>8+</sup> ### getOAuthList<sup>8+</sup>
getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void; getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
获取指定应用帐户和鉴权类型的OAuth令牌的授权列表,使用callback回调异步返回结果。 获取指定应用帐户和鉴权类型的OAuth令牌的授权列表,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ---------------------------------------- | ---- | ------------------ |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 查询结果的回调。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 查询结果的回调。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1320,24 +1401,26 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt ...@@ -1320,24 +1401,26 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback&lt;Array&lt
### getOAuthList<sup>8+</sup> ### getOAuthList<sup>8+</sup>
getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;; getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
获取指定应用帐户和鉴权类型的OAuth令牌的授权列表,使用Promise方式异步返回结果。 获取指定应用帐户和鉴权类型的OAuth令牌的授权列表,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ------------------- | | ------ | ------ | ---- | ---------------------- |
| name | string | 是 | 应用帐户的名称。 | | name | string | 是 | 应用帐户的名称。 |
| owner | string | 是 | 应用帐户的所有者包名。 | | owner | string | 是 | 应用帐户的所有者包名。 |
- 参数: **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------ | ------------------------------------ | | ---------------------------------- | ----------------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;Array&lt;string&gt;&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1350,18 +1433,20 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt; ...@@ -1350,18 +1433,20 @@ getOAuthList(name: string, authType: string): Promise&lt;Array&lt;string&gt;&gt;
### getAuthenticatorCallback<sup>8+</sup> ### getAuthenticatorCallback<sup>8+</sup>
getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;AuthenticatorCallback&gt;): void; getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;AuthenticatorCallback&gt;): void
获取鉴权会话的认证器回调,使用callback回调异步返回结果。 获取鉴权会话的认证器回调,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| --------- | ------------------------------------------ | ---- | -------------- |
| sessionId | string | 是 | 鉴权会话的标识。 |
| callback | AsyncCallback&lt;AuthenticatorCallback&gt; | 是 | 查询结果的回调。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------------------ | ---- | ---------------- |
| sessionId | string | 是 | 鉴权会话的标识。 |
| callback | AsyncCallback&lt;AuthenticatorCallback&gt; | 是 | 查询结果的回调。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1383,23 +1468,25 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic ...@@ -1383,23 +1468,25 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback&lt;Authentic
### getAuthenticatorCallback<sup>8+</sup> ### getAuthenticatorCallback<sup>8+</sup>
getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt;; getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt;
获取鉴权会话的认证器回调,使用Promise方式异步返回结果。 获取鉴权会话的认证器回调,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | -------------- | | --------- | ------ | ---- | ---------------- |
| sessionId | string | 是 | 鉴权会话的标识。 | | sessionId | string | 是 | 鉴权会话的标识。 |
- 参数: **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------------ | -------------------------------- | | ------------------------------------ | ----------------------------------- |
| Promise&lt;AuthenticatorCallback&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;AuthenticatorCallback&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1421,18 +1508,20 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt ...@@ -1421,18 +1508,20 @@ getAuthenticatorCallback(sessionId: string): Promise&lt;AuthenticatorCallback&gt
### getAuthenticatorInfo<sup>8+</sup> ### getAuthenticatorInfo<sup>8+</sup>
getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo&gt;): void; getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo&gt;): void
获取指定应用帐户的认证器信息,使用callback回调异步返回结果。 获取指定应用帐户的认证器信息,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | -------------------------------------- | ---- | ------------------- |
| owner | string | 是 | 应用帐户的所有者包名。 |
| callback | AsyncCallback&lt;AuthenticatorInfo&gt; | 是 | 查询结果的回调。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------------------- | ---- | ---------------------- |
| owner | string | 是 | 应用帐户的所有者包名。 |
| callback | AsyncCallback&lt;AuthenticatorInfo&gt; | 是 | 查询结果的回调。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1444,23 +1533,25 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo ...@@ -1444,23 +1533,25 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback&lt;AuthenticatorInfo
### getAuthenticatorInfo<sup>8+</sup> ### getAuthenticatorInfo<sup>8+</sup>
getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;; getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;
获取指定应用帐户的认证器信息,使用Promise方式异步返回结果。 获取指定应用帐户的认证器信息,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ----- | ------ | ---- | -------------------- | | ------ | ------ | ---- | ---------------------- |
| owner | string | 是 | 应用帐户的所有者包名。 | | owner | string | 是 | 应用帐户的所有者包名。 |
- 参数: **参数:**
| 类型 | 说明 | | 类型 | 说明 |
| ------------------------------ | ----------------------------------- | | -------------------------------- | ----------------------------------- |
| Promise&lt;AuthenticatorInfo&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;AuthenticatorInfo&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1475,26 +1566,32 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;; ...@@ -1475,26 +1566,32 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;;
表示应用帐号信息。 表示应用帐号信息。
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| ----- | ------ | ---- | ---------------- |
| owner | string | 是 | 应用帐户的所有者包名。 | | 参数名 | 类型 | 必填 | 说明 |
| name | string | 是 | 应用帐户的名称。 | | ------ | ------ | ---- | ---------------------- |
| owner | string | 是 | 应用帐户的所有者包名。 |
| name | string | 是 | 应用帐户的名称。 |
## OAuthTokenInfo<sup>8+</sup> ## OAuthTokenInfo<sup>8+</sup>
表示OAuth令牌信息。 表示OAuth令牌信息。
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| -------- | ------ | ---- | -------------- |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---------------- |
| authType | string | 是 | 令牌的鉴权类型。 | | authType | string | 是 | 令牌的鉴权类型。 |
| token | string | 是 | 令牌的取值。 | | token | string | 是 | 令牌的取值。 |
## AuthenticatorInfo<sup>8+</sup> ## AuthenticatorInfo<sup>8+</sup>
表示OAuth认证器信息。 表示OAuth认证器信息。
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| ------- | ------ | ---- | ------------------ |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | -------------------- |
| owner | string | 是 | 认证器的所有者包名。 | | owner | string | 是 | 认证器的所有者包名。 |
| iconId | string | 是 | 认证器的图标标识。 | | iconId | string | 是 | 认证器的图标标识。 |
| labelId | string | 是 | 认证器的标签标识。 | | labelId | string | 是 | 认证器的标签标识。 |
...@@ -1503,45 +1600,49 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;; ...@@ -1503,45 +1600,49 @@ getAuthenticatorInfo(owner: string): Promise&lt;AuthenticatorInfo&gt;;
表示常量的枚举。 表示常量的枚举。
| 名称 | 默认值 | 描述 | **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| ----------------------------- | ---------------------- | ----------------------- |
| 名称 | 默认值 | 描述 |
| ----------------------------- | ---------------------- | ------------------------- |
| ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | 表示操作_隐式添加帐号。 | | ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | 表示操作_隐式添加帐号。 |
| ACTION_AUTHENTICATE | "authenticate" | 表示操作_鉴权。 | | ACTION_AUTHENTICATE | "authenticate" | 表示操作_鉴权。 |
| KEY_NAME | "name" | 表示键名_应用帐户名称。 | | KEY_NAME | "name" | 表示键名_应用帐户名称。 |
| KEY_OWNER | "owner" | 表示键名_应用帐户所有者。 | | KEY_OWNER | "owner" | 表示键名_应用帐户所有者。 |
| KEY_TOKEN | "token" | 表示键名_令牌。 | | KEY_TOKEN | "token" | 表示键名_令牌。 |
| KEY_ACTION | "action" | 表示键名_操作。 | | KEY_ACTION | "action" | 表示键名_操作。 |
| KEY_AUTH_TYPE | "authType" | 表示键名_鉴权类型。 | | KEY_AUTH_TYPE | "authType" | 表示键名_鉴权类型。 |
| KEY_SESSION_ID | "sessionId" | 表示键名_会话标识。 | | KEY_SESSION_ID | "sessionId" | 表示键名_会话标识。 |
| KEY_CALLER_PID | "callerPid" | 表示键名_调用方PID。 | | KEY_CALLER_PID | "callerPid" | 表示键名_调用方PID。 |
| KEY_CALLER_UID | "callerUid" | 表示键名_调用方UID。 | | KEY_CALLER_UID | "callerUid" | 表示键名_调用方UID。 |
| KEY_CALLER_BUNDLE_NAME | "callerBundleName" | 表示键名_调用方包名。 | | KEY_CALLER_BUNDLE_NAME | "callerBundleName" | 表示键名_调用方包名。 |
## ResultCode<sup>8+</sup> ## ResultCode<sup>8+</sup>
表示返回码的枚举。 表示返回码的枚举。
| 名称 | 默认值 | 描述 | **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.AppAccount。
| ----------------------------------- | ----- | ---------------------- |
| SUCCESS | 0 | 表示操作成功。 | | 名称 | 默认值 | 描述 |
| ERROR_ACCOUNT_NOT_EXIST | 10001 | 表示应用帐户不存在。 | | ----------------------------------- | ------ | ------------------------ |
| ERROR_APP_ACCOUNT_SERVICE_EXCEPTION | 10002 | 表示应用帐户服务异常。 | | SUCCESS | 0 | 表示操作成功。 |
| ERROR_INVALID_PASSWORD | 10003 | 表示密码无效。 | | ERROR_ACCOUNT_NOT_EXIST | 10001 | 表示应用帐户不存在。 |
| ERROR_INVALID_REQUEST | 10004 | 表示请求无效。 | | ERROR_APP_ACCOUNT_SERVICE_EXCEPTION | 10002 | 表示应用帐户服务异常。 |
| ERROR_INVALID_RESPONSE | 10005 | 表示响应无效。 | | ERROR_INVALID_PASSWORD | 10003 | 表示密码无效。 |
| ERROR_NETWORK_EXCEPTION | 10006 | 表示网络异常。 | | ERROR_INVALID_REQUEST | 10004 | 表示请求无效。 |
| ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST | 10007 | 表示认证器不存在。 | | ERROR_INVALID_RESPONSE | 10005 | 表示响应无效。 |
| ERROR_OAUTH_CANCELED | 10008 | 表示鉴权取消。 | | ERROR_NETWORK_EXCEPTION | 10006 | 表示网络异常。 |
| ERROR_OAUTH_LIST_TOO_LARGE | 10009 | 表示开放授权列表过大。 | | ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST | 10007 | 表示认证器不存在。 |
| ERROR_OAUTH_SERVICE_BUSY | 10010 | 表示开放授权服务忙碌。 | | ERROR_OAUTH_CANCELED | 10008 | 表示鉴权取消。 |
| ERROR_OAUTH_SERVICE_EXCEPTION | 10011 | 表示开放授权服务异常。 | | ERROR_OAUTH_LIST_TOO_LARGE | 10009 | 表示开放授权列表过大。 |
| ERROR_OAUTH_SESSION_NOT_EXIST | 10012 | 表示鉴权会话不存在。 | | ERROR_OAUTH_SERVICE_BUSY | 10010 | 表示开放授权服务忙碌。 |
| ERROR_OAUTH_TIMEOUT | 10013 | 表示鉴权超时。 | | ERROR_OAUTH_SERVICE_EXCEPTION | 10011 | 表示开放授权服务异常。 |
| ERROR_OAUTH_TOKEN_NOT_EXIST | 10014 | 表示开放授权令牌不存在。 | | ERROR_OAUTH_SESSION_NOT_EXIST | 10012 | 表示鉴权会话不存在。 |
| ERROR_OAUTH_TOKEN_TOO_MANY | 10015 | 表示开放授权令牌过多。 | | ERROR_OAUTH_TIMEOUT | 10013 | 表示鉴权超时。 |
| ERROR_OAUTH_UNSUPPORT_ACTION | 10016 | 表示不支持的鉴权操作。 | | ERROR_OAUTH_TOKEN_NOT_EXIST | 10014 | 表示开放授权令牌不存在。 |
| ERROR_OAUTH_UNSUPPORT_AUTH_TYPE | 10017 | 表示不支持的鉴权类型。 | | ERROR_OAUTH_TOKEN_TOO_MANY | 10015 | 表示开放授权令牌过多。 |
| ERROR_PERMISSION_DENIED | 10018 | 表示权限不足。 | | ERROR_OAUTH_UNSUPPORT_ACTION | 10016 | 表示不支持的鉴权操作。 |
| ERROR_OAUTH_UNSUPPORT_AUTH_TYPE | 10017 | 表示不支持的鉴权类型。 |
| ERROR_PERMISSION_DENIED | 10018 | 表示权限不足。 |
## AuthenticatorCallback<sup>8+</sup> ## AuthenticatorCallback<sup>8+</sup>
...@@ -1549,17 +1650,19 @@ OAuth认证器回调接口。 ...@@ -1549,17 +1650,19 @@ OAuth认证器回调接口。
### onResult<sup>8+</sup> ### onResult<sup>8+</sup>
onResult: (code: number, result: {[key: string]: any}) =&gt; void; onResult: (code: number, result: {[key: string]: any}) =&gt; void
通知鉴权结果。 通知鉴权结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 |
| ------ | -------------------- | ---- | ----------- |
| code | number | 是 | 鉴权结果码。 |
| result | {[key: string]: any} | 是 | 鉴权结果。 |
- 示例: **参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | -------------------- | ---- | ------------ |
| code | number | 是 | 鉴权结果码。 |
| result | {[key: string]: any} | 是 | 鉴权结果。 |
**示例:**
``` ```
const appAccountManager = account_appAccount.createAppAccountManager(); const appAccountManager = account_appAccount.createAppAccountManager();
...@@ -1577,16 +1680,18 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void; ...@@ -1577,16 +1680,18 @@ onResult: (code: number, result: {[key: string]: any}) =&gt; void;
### onRequestRedirected<sup>8+</sup> ### onRequestRedirected<sup>8+</sup>
onRequestRedirected: (request: Want) =&gt; void; onRequestRedirected: (request: Want) =&gt; void
通知鉴权请求被跳转。 通知鉴权请求被跳转。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ---- | ---- | ------------------ | **参数:**
| request | Want | 是 | 用于跳转的请求信息。 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ---- | ---- | -------------------- |
| request | Want | 是 | 用于跳转的请求信息。 |
- 示例: **示例:**
``` ```
class MyAuthenticator extends account_appAccount.Authenticator { class MyAuthenticator extends account_appAccount.Authenticator {
...@@ -1612,34 +1717,38 @@ OAuth认证器基类。 ...@@ -1612,34 +1717,38 @@ OAuth认证器基类。
### addAccountImplicitly<sup>8+</sup> ### addAccountImplicitly<sup>8+</sup>
addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void; addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void
根据指定的鉴权类型和可选项,隐式地添加应用帐户,并使用callback回调异步返回结果。 根据指定的鉴权类型和可选项,隐式地添加应用帐户,并使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 参数名 | 类型 | 必填 | 说明 |
| ---------------- | --------------------- | --- | -------------------------- | **参数:**
| authType | string | 是 | 应用帐户的鉴权类型。 | | 参数名 | 类型 | 必填 | 说明 |
| callerBundleName | string | 是 | 鉴权请求方的包名。 | | ---------------- | --------------------- | ---- | ------------------------------ |
| options | {[key: string]: any} | 是 | 鉴权所需要的可选项。 | | authType | string | 是 | 应用帐户的鉴权类型。 |
| callback | AuthenticatorCallback | 是 | 认证器回调,用于返回鉴权结果。 | | callerBundleName | string | 是 | 鉴权请求方的包名。 |
| options | {[key: string]: any} | 是 | 鉴权所需要的可选项。 |
| callback | AuthenticatorCallback | 是 | 认证器回调,用于返回鉴权结果。 |
### authenticate<sup>8+</sup> ### authenticate<sup>8+</sup>
authenticate(name: string, authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void; authenticate(name: string, authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void
对应用帐户进行鉴权,获取OAuth令牌,并使用callback回调异步返回结果。 对应用帐户进行鉴权,获取OAuth令牌,并使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.AppAccount
| 接口名 | 类型 | 必填 | 说明 |
| ---------------- | --------------------- | ---- | -------------------------- | **参数:**
| name | string | 是 | 应用帐户的名称。 | | 接口名 | 类型 | 必填 | 说明 |
| authType | string | 是 | 应用帐户的鉴权类型。 | | ---------------- | --------------------- | ---- | ------------------------------ |
| callerBundleName | string | 是 | 鉴权请求方的包名。 | | name | string | 是 | 应用帐户的名称。 |
| options | {[key: string]: any} | 是 | 鉴权所需要的可选项。 | | authType | string | 是 | 应用帐户的鉴权类型。 |
| callback | AuthenticatorCallback | 是 | 认证器回调,用于返回鉴权结果。 | | callerBundleName | string | 是 | 鉴权请求方的包名。 |
| options | {[key: string]: any} | 是 | 鉴权所需要的可选项。 |
| callback | AuthenticatorCallback | 是 | 认证器回调,用于返回鉴权结果。 |
- 示例: **示例:**
``` ```
class MyAuthenticator extends account_appAccount.Authenticator { class MyAuthenticator extends account_appAccount.Authenticator {
...@@ -1663,4 +1772,4 @@ authenticate(name: string, authType: string, callerBundleName: string, options: ...@@ -1663,4 +1772,4 @@ authenticate(name: string, authType: string, callerBundleName: string, options:
return new MyAuthenticator(); return new MyAuthenticator();
} }
} }
``` ```
\ No newline at end of file
...@@ -137,7 +137,7 @@ createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback<Audio ...@@ -137,7 +137,7 @@ createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback<Audio
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| :------- | :---------------------------------------------- | :--- | :--------------- | | :------- | :---------------------------------------------- | :--- | :--------------- |
| options | [AudioCapturerOptions](#AudioCapturerOptions) | 是 | 配置音频采集器。 | | options | [AudioCapturerOptions](#audiocaptureroptions8) | 是 | 配置音频采集器。 |
| callback | AsyncCallback<[AudioCapturer](#audiocapturer8)> | 是 | 音频采集器对象。 | | callback | AsyncCallback<[AudioCapturer](#audiocapturer8)> | 是 | 音频采集器对象。 |
**示例:** **示例:**
...@@ -181,9 +181,9 @@ createAudioCapturer(options: AudioCapturerOptions): Promise<AudioCapturer\> ...@@ -181,9 +181,9 @@ createAudioCapturer(options: AudioCapturerOptions): Promise<AudioCapturer\>
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| :------ | :------------------- | :--- | :--------------- | | :------ | :--------------------------------------------- | :--- | :--------------- |
| options | AudioCapturerOptions | 是 | 配置音频采集器。 | | options | [AudioCapturerOptions](#audiocaptureroptions8) | 是 | 配置音频采集器。 |
**返回值:** **返回值:**
...@@ -571,6 +571,17 @@ let audioCapturer = await audio.createAudioCapturer(audioCapturerOptions); ...@@ -571,6 +571,17 @@ let audioCapturer = await audio.createAudioCapturer(audioCapturerOptions);
| CONNECT | 0 | 设备连接。 | | CONNECT | 0 | 设备连接。 |
| DISCONNECT | 1 | 断开设备连接。 | | DISCONNECT | 1 | 断开设备连接。 |
## AudioCapturerOptions<sup>8+</sup>
音频采集器选项信息。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Audio.Capturer
| 名称 | 类型 | 必填 | 说明 |
| ------------ | --------------------------------------- | ---- | ---------------- |
| streamInfo | [AudioStreamInfo](#audiostreaminfo8) | 是 | 表示音频流信息。 |
| rendererInfo | [AudioCapturerInfo](#audiocapturerinfo) | 是 | 表示采集器信息。 |
## AudioCapturerInfo<sup>8+</sup><a name="audiocapturerinfo"></a> ## AudioCapturerInfo<sup>8+</sup><a name="audiocapturerinfo"></a>
描述音频采集器信息。 描述音频采集器信息。
...@@ -2698,9 +2709,9 @@ getStreamInfo(callback: AsyncCallback<AudioStreamInfo\>): void ...@@ -2698,9 +2709,9 @@ getStreamInfo(callback: AsyncCallback<AudioStreamInfo\>): void
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| :------- | :-------------------------------------------------------- | :--- | :------------------------------- | | :------- | :--------------------------------------------------- | :--- | :------------------------------- |
| callback | AsyncCallback<[AudioStreamInfo](#AudioRendererOptions8)\> | 是 | 使用callback方式异步返回流信息。 | | callback | AsyncCallback<[AudioStreamInfo](#audiostreaminfo8)\> | 是 | 使用callback方式异步返回流信息。 |
**示例:** **示例:**
...@@ -2728,9 +2739,9 @@ getStreamInfo(): Promise<AudioStreamInfo\> ...@@ -2728,9 +2739,9 @@ getStreamInfo(): Promise<AudioStreamInfo\>
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :-------------------------------------------------- | :------------------------------ | | :--------------------------------------------- | :------------------------------ |
| Promise<[AudioStreamInfo](#AudioRendererOptions8)\> | 使用Promise方式异步返回流信息。 | | Promise<[AudioStreamInfo](#audiostreaminfo8)\> | 使用Promise方式异步返回流信息。 |
**示例:** **示例:**
......
...@@ -461,7 +461,7 @@ queryMyCard(attrs?: ContactAttributes): Promise&lt;Contact&gt; ...@@ -461,7 +461,7 @@ queryMyCard(attrs?: ContactAttributes): Promise&lt;Contact&gt;
## contact.selectContact ## contact.selectContact
selectContact(AsyncCallback&lt;Array&lt;Contact&gt;&gt;): void selectContact(callback: AsyncCallback&lt;Array&lt;Contact&gt;&gt;): void
选择联系人,使用callback方式作为异步方法。 选择联系人,使用callback方式作为异步方法。
......
...@@ -21,12 +21,12 @@ write(eventName: string, eventType: EventType, keyValues: object, callback: Asyn ...@@ -21,12 +21,12 @@ write(eventName: string, eventType: EventType, keyValues: object, callback: Asyn
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | --------- | ------------------------- | ---- | ------------------------------------------------------------ |
| eventName | string | 是 | 应用事件名称。 | | eventName | string | 是 | 应用事件名称。<br/>由开发者自定义。事件名称在48个字符以内,有效的字符是0-9、a-z、下划线,只能以字母开头。 |
| eventType | [EventType](#eventtype) | 是 | 应用事件类型。 | | eventType | [EventType](#eventtype) | 是 | 应用事件类型。 |
| keyValues | object | 是 | 应用事件的参数,key类型只能为string,value类型只能为string、number、boolean、Array(数组数据类型只能为string、number、boolean)。 | | keyValues | object | 是 | 事件参数键值对,如果是变长参数类型,则依次输入事件的参数名与参数值。如果是Json对象类型,则Json对象的key是事件的参数名,value是事件的参数值。<br/>- key类型只能为string,value类型只能为string、number、boolean、Array(数组数据类型只能为string、number、boolean)。<br/>- 事件的参数个数必须小于等于32。<br/>- 参数名在16个字符以内,有效的字符是0-9、a-z、下划线,只能以字母开头,不能以下划线结尾。<br/>- string类型参数值在8*1024个字符内。<br/>- Array类型参数值的元素个数必须在100个以内,超出时会进行截断处理。 |
| callback | AsyncCallback&lt;void&gt; | 否 | 回调函数,可以在回调函数中处理接口返回值。<br/>-&nbsp;返回值为0表示事件校验成功,事件正常异步写入事件文件;<br/>-&nbsp;大于0表示事件校验存在异常参数,在忽略异常参数后将事件异步写入事件文件;<br/>-&nbsp;小于0表示事件校验失败,不将事件写入事件文件。 | | callback | AsyncCallback&lt;void&gt; | 否 | 回调函数,可以在回调函数中处理接口返回值。<br/>-&nbsp;返回值为0表示事件校验成功,事件正常异步写入事件文件;<br/>-&nbsp;大于0表示事件校验存在异常参数,在忽略异常参数后将事件异步写入事件文件;<br/>-&nbsp;小于0表示事件校验失败,不将事件写入事件文件。 |
**示例:** **示例:**
...@@ -54,16 +54,16 @@ write(eventName: string, eventType: EventType, keyValues: object): Promise&lt;vo ...@@ -54,16 +54,16 @@ write(eventName: string, eventType: EventType, keyValues: object): Promise&lt;vo
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | --------- | ----------------------- | ---- | ------------------------------------------------------------ |
| eventName | string | 是 | 应用事件名称。 | | eventName | string | 是 | 应用事件名称。<br/>由开发者自定义。事件名称在48个字符以内,有效的字符是0-9、a-z、下划线,只能以字母开头。 |
| eventType | [EventType](#eventtype) | 是 | 应用事件类型。 | | eventType | [EventType](#eventtype) | 是 | 应用事件类型。 |
| keyValues | object | 是 | 应用事件的参数,key类型只能为string,value类型只能为string、number、boolean、Array(数组数据类型只能为string、number、boolean)。 | | keyValues | object | 是 | 事件参数键值对,如果是变长参数类型,则依次输入事件的参数名与参数值。如果是Json对象类型,则Json对象的key是事件的参数名,value是事件的参数值。<br/>- key类型只能为string,value类型只能为string、number、boolean、Array(数组数据类型只能为string、number、boolean)。<br/>- 事件的参数个数必须小于等于32。<br/>- 参数名在16个字符以内,有效的字符是0-9、a-z、下划线,只能以字母开头,不能以下划线结尾。<br/>- string类型参数值在8*1024个字符内。<br/>- Array类型参数值的元素个数必须在100个以内,超出时会进行截断处理。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | ------------------- | ------------------------------------------------------------ |
| Promise&lt;void&gt; | Promise实例,可以在其then()、catch()方法中分别对事件写入成功、写入异常的情况进行回调处理。 | | Promise&lt;void&gt; | Promise实例,可以在其then()、catch()方法中分别对事件写入成功、写入异常的情况进行回调处理。 |
**示例:** **示例:**
...@@ -90,14 +90,14 @@ configure(config: ConfigOption): boolean ...@@ -90,14 +90,14 @@ configure(config: ConfigOption): boolean
**参数:** **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ------ | ----------------------------- | ---- | ------------------------ |
| config | [ConfigOption](#configoption) | 是 | 应用事件打点配置项对象。 | | config | [ConfigOption](#configoption) | 是 | 应用事件打点配置项对象。 |
**返回值:** **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| -------- | -------- | | ------- | ----------------------------------------------------------- |
| boolean | 配置结果,true&nbsp;表示配置成功,false&nbsp;表示配置失败。 | | boolean | 配置结果,true&nbsp;表示配置成功,false&nbsp;表示配置失败。 |
**示例:** **示例:**
...@@ -120,10 +120,10 @@ hiAppEvent.configure({ ...@@ -120,10 +120,10 @@ hiAppEvent.configure({
**系统能力:** 以下各项对应的系统能力均为SystemCapability.HiviewDFX.HiAppEvent。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.HiviewDFX.HiAppEvent。
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | ---------- | ------- | ---- | ------------------------------------------------------------ |
| disable | boolean | 否 | 应用打点功能开关。配置值为true表示关闭打点功能,false表示不关闭打点功能。 | | disable | boolean | 否 | 应用打点功能开关。配置值为true表示关闭打点功能,false表示不关闭打点功能。 |
| maxStorage | string | 否 | 打点数据本地存储文件所在目录的配额大小,默认限额为“10M”。所在目录大小超出限额后会对目录进行清理操作,会按从旧到新的顺序逐个删除打点数据文件,直到目录大小不超出限额时停止。 | | maxStorage | string | 否 | 打点数据本地存储文件所在目录的配额大小,默认限额为“10M”。所在目录大小超出限额后会对目录进行清理操作,会按从旧到新的顺序逐个删除打点数据文件,直到目录大小不超出限额时停止。 |
## EventType ## EventType
...@@ -132,12 +132,12 @@ hiAppEvent.configure({ ...@@ -132,12 +132,12 @@ hiAppEvent.configure({
**系统能力:** 以下各项对应的系统能力均为SystemCapability.HiviewDFX.HiAppEvent。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.HiviewDFX.HiAppEvent。
| 名称 | 默认值 | 说明 | | 名称 | 默认值 | 说明 |
| -------- | -------- | -------- | | --------- | ------ | -------------- |
| FAULT | 1 | 故障类型事件。 | | FAULT | 1 | 故障类型事件。 |
| STATISTIC | 2 | 统计类型事件。 | | STATISTIC | 2 | 统计类型事件。 |
| SECURITY | 3 | 安全类型事件。 | | SECURITY | 3 | 安全类型事件。 |
| BEHAVIOR | 4 | 行为类型事件。 | | BEHAVIOR | 4 | 行为类型事件。 |
## Event ## Event
...@@ -146,11 +146,11 @@ hiAppEvent.configure({ ...@@ -146,11 +146,11 @@ hiAppEvent.configure({
**系统能力:** 以下各项对应的系统能力均为SystemCapability.HiviewDFX.HiAppEvent。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.HiviewDFX.HiAppEvent。
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | ------------------------- | -------- | ---- | ---- | -------------------- |
| USER_LOGIN | string | 是 | 否 | 用户登录事件。 | | USER_LOGIN | string | 是 | 否 | 用户登录事件。 |
| USER_LOGOUT | string | 是 | 否 | 用户登出事件。 | | USER_LOGOUT | string | 是 | 否 | 用户登出事件。 |
| DISTRIBUTED_SERVICE_START | string | 是 | 否 | 分布式服务启动事件。 | | DISTRIBUTED_SERVICE_START | string | 是 | 否 | 分布式服务启动事件。 |
## Param ## Param
...@@ -159,8 +159,8 @@ hiAppEvent.configure({ ...@@ -159,8 +159,8 @@ hiAppEvent.configure({
**系统能力:** 以下各项对应的系统能力均为SystemCapability.HiviewDFX.HiAppEvent。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.HiviewDFX.HiAppEvent。
| 名称 | 参数类型 | 可读 | 可写 | 说明 | | 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- | | ------------------------------- | -------- | ---- | ---- | ------------------ |
| USER_ID | string | 是 | 否 | 用户自定义ID。 | | USER_ID | string | 是 | 否 | 用户自定义ID。 |
| DISTRIBUTED_SERVICE_NAME | string | 是 | 否 | 分布式服务名称。 | | DISTRIBUTED_SERVICE_NAME | string | 是 | 否 | 分布式服务名称。 |
| DISTRIBUTED_SERVICE_INSTANCE_ID | string | 是 | 否 | 分布式服务实例ID。 | | DISTRIBUTED_SERVICE_INSTANCE_ID | string | 是 | 否 | 分布式服务实例ID。 |
\ No newline at end of file
# 输入监听
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>
> - 本模块接口均为系统接口,三方应用不支持调用。
## 导入模块
```
import inputMonitor from '@ohos.multimodalInput.inputMonitor';
```
## 权限
ohos.permission.INPUT_MONITORING
## inputMonitor.on
on(type: "touch", receiver: TouchEventReceiver): void
开始监听全局输入。
**需要权限:**ohos.permission.INPUT_MONITORING
**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 监听输入事件类型,只支持“touch”。 |
| receiver | [TouchEventReceiver](#toucheventreceiver) | 是 | 触摸输入事件回调函数。 |
**示例:**
```
callback: function (value) {
if (checkEvent(value)) {
//事件满足业务要求,事件被消费
return true;
} else {
//事件不满足业务要求,事件未被消费
return false;
}
},
testOn: function () {
console.info("InputMonitorJsTest---start---testOn");
inputMonitor.on(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOn");
}
```
## inputMonitor.off
off(type: "touch", receiver: TouchEventReceiver): void
停止监听全局输入。
**需要权限:**ohos.permission.INPUT_MONITORING
**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| type | string | 是 | 监听输入事件类型,只支持“touch”。 |
| receiver | [TouchEventReceiver](#toucheventreceiver) | 否 | 触摸输入事件回调函数。 |
**示例:**
```
callback: function (value) {
if (checkEvent(value)) {
//事件满足业务要求,事件被消费
return true;
} else {
//事件不满足业务要求,事件未被消费
return false;
}
},
testOff: function () {
console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOff");
}
```
## TouchEventReceiver
触摸输入事件的回调函数,如果返回true,则触摸输入将被监听器消耗(系统执行关闭动作)。
### (touchEvent: TouchEvent): Boolean
触摸输入事件的回调函数。函数名由使用者定义,这里是函数调用时必须符合的格式,传入参数必须为TouchEvent类型,返回值为Boolean类型。
**系统能力:**SystemCapability.MultimodalInput.Input.InputMonitor
**参数:**
| 参数 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| touchEvent | [TouchEvent](../arkui-js/js-components-common-events.md) | 是 | 触摸输入事件回调函数,返回true表示输触事件被监听器消费,false表示输触事件未被监听器消费。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Boolean | 返回true表示输触事件被监听器消费,false表示输触事件未被监听器消费。 |
**示例:**
```
callback: function (value) { //此处为(touchEvent:TouchEvent): Boolean 方法的实现
if (checkEvent(value)) {
//事件满足业务要求,事件被消费
return true;
} else {
//事件不满足业务要求,事件未被消费
return false;
}
},
testOff: function () {
console.info("InputMonitorJsTest---start---testOff");
inputMonitor.off(
"touch",
this.callback
);
console.info("InputMonitorJsTest---end---testOff");
}
```
...@@ -1346,6 +1346,12 @@ setSpeed(speed:number): Promise\<number> ...@@ -1346,6 +1346,12 @@ setSpeed(speed:number): Promise\<number>
| ------ | ------ | ---- | ---------------------------------------------------------- | | ------ | ------ | ---- | ---------------------------------------------------------- |
| speed | number | 是 | 指定播放视频速度,具体见[PlaybackSpeed](#playbackspeed8)。 | | speed | number | 是 | 指定播放视频速度,具体见[PlaybackSpeed](#playbackspeed8)。 |
**返回值:**
| 类型 | 说明 |
| ---------------- | ------------------------- |
| Promise\<number> | 通过Promise获取设置结果。 |
**示例:** **示例:**
```js ```js
...@@ -1632,7 +1638,7 @@ audioRecorder.pause(); ...@@ -1632,7 +1638,7 @@ audioRecorder.pause();
resume():void resume():void
暂停录制,需要在[pause](#audiorecorder_on)事件成功触发后,才能调用resume方法。 恢复录制,需要在[pause](#audiorecorder_on)事件成功触发后,才能调用resume方法。
**系统能力:** SystemCapability.Multimedia.Media.AudioRecorder **系统能力:** SystemCapability.Multimedia.Media.AudioRecorder
...@@ -2401,7 +2407,7 @@ on(type: 'error', callback: ErrorCallback): void ...@@ -2401,7 +2407,7 @@ on(type: 'error', callback: ErrorCallback): void
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------- | ---- | ------------------------------------------------------------ | | -------- | ------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 录制错误事件回调类型'error'。<br/>-&nbsp;'error':频录制过程中发生错误,触发该事件。 | | type | string | 是 | 录制错误事件回调类型'error'。<br/>-&nbsp;'error':频录制过程中发生错误,触发该事件。 |
| callback | ErrorCallback | 是 | 录制错误事件回调方法。 | | callback | ErrorCallback | 是 | 录制错误事件回调方法。 |
**示例:** **示例:**
......
...@@ -10,33 +10,34 @@ ...@@ -10,33 +10,34 @@
import account_osAccount from '@ohos.account.osAccount'; import account_osAccount from '@ohos.account.osAccount';
``` ```
## 系统能力
SystemCapability.Account.OsAccount
## account_osAccount.getAccountManager ## account_osAccount.getAccountManager
getAccountManager(): AccountManager getAccountManager(): AccountManager
获取系统帐号能力的实例。 获取系统帐号能力的实例。
- 返回值: **系统能力:** SystemCapability.Account.OsAccount
| 类型 | 说明 |
| -------- | -------- |
| [AccountManager](#accountmanager) | 获取系统帐号能力的实例。 |
- 示例: **返回值:**
| 类型 | 说明 |
| --------------------------------- | ------------------------ |
| [AccountManager](#accountmanager) | 获取系统帐号能力的实例。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
``` ```
## OsAccountType ## OsAccountType
枚举,系统帐号类型。 枚举,系统帐号类型。
| 参数 | 默认值 | 说明 |
| -------- | -------- | -------- | **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount。
| ADMIN | 0 | 管理员帐号。|
| NORMAL | 1 | 普通帐号。| | 参数 | 默认值 | 说明 |
| GUEST | 2 | 访客帐号。| | ------ | ------ | ------------ |
| ADMIN | 0 | 管理员帐号。 |
| NORMAL | 1 | 普通帐号。 |
| GUEST | 2 | 访客帐号。 |
## AccountManager ## AccountManager
...@@ -48,14 +49,18 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void ...@@ -48,14 +49,18 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
激活指定系统帐号,使用callback回调异步返回结果。 激活指定系统帐号,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ------------------- | ---- | -------------------- |
| localId | number | 是 | 要激活的系统帐号ID。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 |
- 示例:激活ID为100的系统帐号 | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | -------------------- |
| localId | number | 是 | 要激活的系统帐号ID。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 |
**示例:**激活ID为100的系统帐号
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
...@@ -70,19 +75,23 @@ activateOsAccount(localId: number): Promise&lt;void&gt; ...@@ -70,19 +75,23 @@ activateOsAccount(localId: number): Promise&lt;void&gt;
激活指定系统帐号,使用Promise方式异步返回结果。 激活指定系统帐号,使用Promise方式异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ------- | ------ | ---- | ------------ |
| localId | number | 是 | 要激活的系统帐号ID。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | -------------------- |
| localId | number | 是 | 要激活的系统帐号ID。 |
| 类型 | 说明 | **返回值:**
| :------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例:激活ID为100的系统帐号 | 类型 | 说明 |
| :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**激活ID为100的系统帐号
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
var localId = 100; var localId = 100;
...@@ -99,13 +108,15 @@ isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -99,13 +108,15 @@ isMultiOsAccountEnable(callback: AsyncCallback&lt;boolean&gt;): void
判断是否支持多系统帐号,使用callback回调异步返回结果。 判断是否支持多系统帐号,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ------------------------------ | | -------- | ---------------------------- | ---- | --------------------------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,支持多系统帐号则返回true,否则返回false。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,支持多系统帐号则返回true,否则返回false。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -121,13 +132,15 @@ isMultiOsAccountEnable(): Promise&lt;boolean&gt; ...@@ -121,13 +132,15 @@ isMultiOsAccountEnable(): Promise&lt;boolean&gt;
判断是否支持多系统帐号,使用Promise方式异步返回结果。 判断是否支持多系统帐号,使用Promise方式异步返回结果。
- 返回值: **系统能力:** SystemCapability.Account.OsAccount
| 类型 | 说明 | **返回值:**
| :--------------- | :---------------------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果,支持多系统帐号则返回true,否则返回false。 |
- 示例: | 类型 | 说明 |
| :--------------------- | :----------------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果,支持多系统帐号则返回true,否则返回false。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -144,14 +157,18 @@ isOsAccountActived(localId: number, callback: AsyncCallback&lt;boolean&gt;): voi ...@@ -144,14 +157,18 @@ isOsAccountActived(localId: number, callback: AsyncCallback&lt;boolean&gt;): voi
判断指定系统帐号是否处于激活状态,使用callback回调异步返回结果。 判断指定系统帐号是否处于激活状态,使用callback回调异步返回结果。
- 参数: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS、ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ---------------------- | ---- | ------------------------------ |
| localId | number | 是 | 系统帐号ID。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,处于激活状态则返回true,否则返回false。 |
- 示例:判断ID为100的系统帐号是否处于激活状态 | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ------------------------------------------------- |
| localId | number | 是 | 系统帐号ID。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,处于激活状态则返回true,否则返回false。 |
**示例:**判断ID为100的系统帐号是否处于激活状态
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -168,19 +185,23 @@ isOsAccountActived(localId: number): Promise&lt;boolean&gt; ...@@ -168,19 +185,23 @@ isOsAccountActived(localId: number): Promise&lt;boolean&gt;
判断指定系统帐号是否处于激活状态,使用Promise方式异步返回结果。 判断指定系统帐号是否处于激活状态,使用Promise方式异步返回结果。
- 参数: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS、ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------ | | ------- | ------ | ---- | ------------ |
| localId | number | 是 | 系统帐号ID。 | | localId | number | 是 | 系统帐号ID。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :--------------- | :---------------------------------- | | :--------------------- | :----------------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果,处于激活状态则返回true,否则返回false。 | | Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果,处于激活状态则返回true,否则返回false。 |
- 示例:判断ID为100的系统帐号是否处于激活状态 **示例:**判断ID为100的系统帐号是否处于激活状态
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -196,17 +217,21 @@ isOsAccountActived(localId: number): Promise&lt;boolean&gt; ...@@ -196,17 +217,21 @@ isOsAccountActived(localId: number): Promise&lt;boolean&gt;
isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback&lt;boolean&gt;): void isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback&lt;boolean&gt;): void
判断指定系统帐号是否具有指定[约束](#系统帐号约束列表),使用callback回调异步返回结果。 判断指定系统帐号是否具有指定约束,使用callback回调异步返回结果。
- 参数: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| ---------- | ---------------------- | ---- | ------------------------------ |
| localId | number | 是 | 指定的系统帐号ID。 |
| constraint | string | 是 | 指定的[约束](#系统帐号约束列表)名称。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,具有指定约束则返回true,否则返回false。 |
- 示例:判断ID为100的系统帐号是否有禁止使用wifi的[约束](#系统帐号约束列表) **参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ---------------------------- | ---- | ------------------------------------------------- |
| localId | number | 是 | 指定的系统帐号ID。 |
| constraint | string | 是 | 指定的[约束](#系统帐号约束列表)名称。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,具有指定约束则返回true,否则返回false。 |
**示例:**判断ID为100的系统帐号是否有禁止使用wifi的约束
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -221,22 +246,26 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async ...@@ -221,22 +246,26 @@ isOsAccountConstraintEnable(localId: number, constraint: string, callback: Async
isOsAccountConstraintEnable(localId: number, constraint: string): Promise&lt;boolean&gt; isOsAccountConstraintEnable(localId: number, constraint: string): Promise&lt;boolean&gt;
判断指定系统帐号是否具有指定[约束](#系统帐号约束列表),使用Promise方式异步返回结果。 判断指定系统帐号是否具有指定约束,使用Promise方式异步返回结果。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
- 参数: **参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ---------- | ------ | ---- | ---------------- | | ---------- | ------ | ---- | ------------------------------------- |
| localId | number | 是 | 指定的系统帐号ID。 | | localId | number | 是 | 指定的系统帐号ID。 |
| constraint | string | 是 | 指定的[约束](#系统帐号约束列表)名称。 | | constraint | string | 是 | 指定的[约束](#系统帐号约束列表)名称。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :--------------- | :---------------------------------- | | :--------------------- | :----------------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果,具有指定[约束](#系统帐号约束列表)则返回true,否则返回false。 | | Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果,具有指定约束则返回true,否则返回false。 |
- 示例:判断ID为100的系统帐号是否有禁止使用wifi的[约束](#系统帐号约束列表) **示例:**判断ID为100的系统帐号是否有禁止使用wifi的约束
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -254,13 +283,15 @@ isTestOsAccount(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -254,13 +283,15 @@ isTestOsAccount(callback: AsyncCallback&lt;boolean&gt;): void
检查当前系统帐号是否为测试帐号,使用callback回调异步返回结果。 检查当前系统帐号是否为测试帐号,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ---------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,是测试帐号则返回true,否则返回false。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ----------------------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,是测试帐号则返回true,否则返回false。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -276,13 +307,15 @@ isTestOsAccount(): Promise&lt;boolean&gt; ...@@ -276,13 +307,15 @@ isTestOsAccount(): Promise&lt;boolean&gt;
检查当前系统帐号是否为测试帐号,使用Promise方式异步返回结果。 检查当前系统帐号是否为测试帐号,使用Promise方式异步返回结果。
- 返回值: **系统能力:** SystemCapability.Account.OsAccount
**返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :--------------- | :---------------------------------- | | :--------------------- | :----------------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果,是测试帐号则返回true,否则返回false。 | | Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果,是测试帐号则返回true,否则返回false。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -299,13 +332,15 @@ isOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -299,13 +332,15 @@ isOsAccountVerified(callback: AsyncCallback&lt;boolean&gt;): void
检查当前系统帐号是否已验证,使用callback回调异步返回结果。 检查当前系统帐号是否已验证,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ---------------------- | ---- | ---------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,已验证则返回true,否则返回false。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ------------------------------------------- |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,已验证则返回true,否则返回false。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -321,14 +356,16 @@ isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): vo ...@@ -321,14 +356,16 @@ isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): vo
检查指定系统帐号是否已验证,使用callback回调异步返回结果。 检查指定系统帐号是否已验证,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---------------------------------- | | -------- | ---------------------------- | ---- | ------------------------------------------- |
| localId | number | 否 | 指定的系统帐号ID。 | | localId | number | 否 | 指定的系统帐号ID。 |
| callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,已验证则返回true,否则返回false。 | | callback | AsyncCallback&lt;boolean&gt; | 是 | 回调结果,已验证则返回true,否则返回false。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -340,23 +377,25 @@ isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): vo ...@@ -340,23 +377,25 @@ isOsAccountVerified(localId: number, callback: AsyncCallback&lt;boolean&gt;): vo
### isOsAccountVerified ### isOsAccountVerified
isOsAccountVerified(localId: number?): Promise&lt;boolean&gt; isOsAccountVerified(localId?: number): Promise&lt;boolean&gt;
检查指定系统帐号是否已验证,使用Promise方式异步返回结果。 检查指定系统帐号是否已验证,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ------- | ------ | ---- | ------------ |
| localId | number | 否 | 指定的系统帐号ID。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------------ |
| localId | number | 否 | 指定的系统帐号ID。 |
| 类型 | 说明 | **返回值:**
| :--------------- | :---------------------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果,已验证则返回true,否则返回false。 |
- 示例: | 类型 | 说明 |
| :--------------------- | :----------------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise实例,用于获取异步返回结果,已验证则返回true,否则返回false。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -373,14 +412,20 @@ removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void ...@@ -373,14 +412,20 @@ removeOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
删除指定系统帐号,使用callback回调异步返回结果。 删除指定系统帐号,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------- | ---- | ------------------------ | | -------- | ------------------------- | ---- | -------------------- |
| localId | number | 是 | 要删除的系统帐号ID。 | | localId | number | 是 | 要删除的系统帐号ID。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -399,19 +444,25 @@ removeOsAccount(localId: number): Promise&lt;void&gt; ...@@ -399,19 +444,25 @@ removeOsAccount(localId: number): Promise&lt;void&gt;
删除指定系统帐号,使用Promise方式异步返回结果。 删除指定系统帐号,使用Promise方式异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------ | | ------- | ------ | ---- | -------------------- |
| localId | number | 是 | 要删除的系统帐号ID。 | | localId | number | 是 | 要删除的系统帐号ID。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :------------ | :---------------------------------- | | :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -431,18 +482,24 @@ removeOsAccount(localId: number): Promise&lt;void&gt; ...@@ -431,18 +482,24 @@ removeOsAccount(localId: number): Promise&lt;void&gt;
setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean,callback: AsyncCallback&lt;void&gt;): void setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean,callback: AsyncCallback&lt;void&gt;): void
为指定系统帐号设置/删除[约束](#系统帐号约束列表),使用callback回调异步返回结果。 为指定系统帐号设置/删除约束返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
| 参数名 | 类型 | 必填 | 说明 | **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
| ----------- | ------------------- | ---- | ------------------------------- |
| localId | number | 是 | 系统帐号ID。 |
| constraints | Array&lt;string&gt; | 是 | 待设置/删除的[约束](#系统帐号约束列表)列表。 |
| enable | boolean | 是 | 设置(true)/删除(false) |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 |
- 示例:给ID为100的系统帐号设置禁止使用wifi的[约束](#系统帐号约束列表) **系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------------------------- | ---- | -------------------------------------------- |
| localId | number | 是 | 系统帐号ID。 |
| constraints | Array&lt;string&gt; | 是 | 待设置/删除的[约束](#系统帐号约束列表)列表。 |
| enable | boolean | 是 | 设置(true)/删除(false) |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 |
**示例:**给ID为100的系统帐号设置禁止使用wifi的约束
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -456,23 +513,29 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl ...@@ -456,23 +513,29 @@ setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enabl
setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean): Promise&lt;void&gt; setOsAccountConstraints(localId: number, constraints: Array&lt;string&gt;, enable: boolean): Promise&lt;void&gt;
为指定系统帐号设置/删除[约束](#系统帐号约束列表),使用Promise方式异步返回结果。 为指定系统帐号设置/删除约束回结果。
此接口为系统接口,三方应用不支持调用。
- 参数: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| ----------- | ------------- | ---- | ----------------------- |
| localId | number | 是 | 系统帐号ID。 |
| constraints | Array&lt;string&gt; | 是 | 待设置/删除的[约束](#系统帐号约束列表)列表。 |
| enable | boolean | 是 | 设置(true)/删除(false)。 |
- 返回值: **参数:**
| 类型 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| :------------ | :---------------------------------- | | ----------- | ------------------- | ---- | -------------------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | localId | number | 是 | 系统帐号ID。 |
| constraints | Array&lt;string&gt; | 是 | 待设置/删除的[约束](#系统帐号约束列表)列表。 |
| enable | boolean | 是 | 设置(true)/删除(false)。 |
- 示例:删除ID为100的系统帐号的禁止使用wifi的[约束](#系统帐号约束列表) **返回值:**
| 类型 | 说明 |
| :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**删除ID为100的系统帐号的禁止使用wifi的约束
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -490,15 +553,19 @@ setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt; ...@@ -490,15 +553,19 @@ setOsAccountName(localId: number, localName: string, callback: AsyncCallback&lt;
设置指定系统帐号的帐号名,使用callback回调异步返回结果。 设置指定系统帐号的帐号名,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| :-------- | ------------------- | ---- | ------------------------ | | :-------- | ------------------------- | ---- | ------------ |
| localId | number | 是 | 系统帐号ID。 | | localId | number | 是 | 系统帐号ID。 |
| localName | string | 是 | 帐号名。 | | localName | string | 是 | 帐号名。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 |
- 示例:将ID为100的系统帐号的帐号名设置成demoName **示例:**将ID为100的系统帐号的帐号名设置成demoName
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -515,20 +582,24 @@ setOsAccountName(localId: number, localName: string): Promise&lt;void&gt; ...@@ -515,20 +582,24 @@ setOsAccountName(localId: number, localName: string): Promise&lt;void&gt;
设置指定系统帐号的帐号名,使用Promise方式异步返回结果。 设置指定系统帐号的帐号名,使用Promise方式异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| --------- | ------ | ---- | ----------------------- |
| localId | number | 是 | 系统帐号ID。 |
| localName | string | 是 | 帐号名。 |
- 返回值: **参数:**
| 类型 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| :------------ | :---------------------------------- | | --------- | ------ | ---- | ------------ |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | localId | number | 是 | 系统帐号ID。 |
| localName | string | 是 | 帐号名。 |
- 示例:将ID为100的系统帐号的帐号名设置成demoName **返回值:**
| 类型 | 说明 |
| :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**将ID为100的系统帐号的帐号名设置成demoName
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -547,13 +618,17 @@ getCreatedOsAccountsCount(callback: AsyncCallback&lt;number&gt;): void ...@@ -547,13 +618,17 @@ getCreatedOsAccountsCount(callback: AsyncCallback&lt;number&gt;): void
获取已创建的系统帐号数量,使用callback回调异步返回结果。 获取已创建的系统帐号数量,使用callback回调异步返回结果。
- 参数: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------------ | | -------- | --------------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是已创建的系统帐号的数量。 | | callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是已创建的系统帐号的数量。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -569,13 +644,17 @@ getCreatedOsAccountsCount(): Promise&lt;number&gt; ...@@ -569,13 +644,17 @@ getCreatedOsAccountsCount(): Promise&lt;number&gt;
获取已创建的系统帐号数量,使用Promise方式异步返回结果。 获取已创建的系统帐号数量,使用Promise方式异步返回结果。
- 返回值: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
| 类型 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| :-------------- | :---------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是已创建的系统帐号的数量。 |
- 示例: **返回值:**
| 类型 | 说明 |
| :-------------------- | :----------------------------------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是已创建的系统帐号的数量。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -592,13 +671,15 @@ getOsAccountLocalIdFromProcess(callback: AsyncCallback&lt;number&gt;): void ...@@ -592,13 +671,15 @@ getOsAccountLocalIdFromProcess(callback: AsyncCallback&lt;number&gt;): void
获取当前进程所属的系统帐号的帐号ID,使用callback回调异步返回结果。 获取当前进程所属的系统帐号的帐号ID,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ----------------------------------------- | | -------- | --------------------------- | ---- | -------------------------------------------------- |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是当前进程所属的系统帐号的帐号ID。 | | callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是当前进程所属的系统帐号的帐号ID。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -614,13 +695,15 @@ getOsAccountLocalIdFromProcess(): Promise&lt;number&gt; ...@@ -614,13 +695,15 @@ getOsAccountLocalIdFromProcess(): Promise&lt;number&gt;
获取当前进程所属的系统帐号的帐号ID,使用Promise方式异步返回结果。 获取当前进程所属的系统帐号的帐号ID,使用Promise方式异步返回结果。
- 返回值: **系统能力:** SystemCapability.Account.OsAccount
| 类型 | 说明 | **返回值:**
| :-------------- | :---------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是当前进程所属的系统帐号的帐号ID。 |
- 示例: | 类型 | 说明 |
| :-------------------- | :----------------------------------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是当前进程所属的系统帐号的帐号ID。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -637,14 +720,16 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;): ...@@ -637,14 +720,16 @@ getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback&lt;number&gt;):
从进程uid中获取该uid所属的系统帐号的帐号ID,使用callback回调异步返回结果。 从进程uid中获取该uid所属的系统帐号的帐号ID,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | --------------------------------------- | | -------- | --------------------------- | ---- | --------------------------------------------- |
| uid | number | 是 | 进程uid。 | | uid | number | 是 | 进程uid。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是uid所属的系统帐号的帐号ID。 | | callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是uid所属的系统帐号的帐号ID。 |
- 示例:查询值为12345678的uid所属的系统帐号的帐号ID **示例:**查询值为12345678的uid所属的系统帐号的帐号ID
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -661,19 +746,21 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt; ...@@ -661,19 +746,21 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt;
从进程uid中获取该uid所属的系统帐号的帐号ID,使用Promise方式异步返回结果。 从进程uid中获取该uid所属的系统帐号的帐号ID,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ------ | ------ | ---- | ------------- |
| uid | number | 是 | 进程uid。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | --------- |
| uid | number | 是 | 进程uid。 |
| 类型 | 说明 | **返回值:**
| :-------------- | :---------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是uid所属的系统帐号的帐号ID。 |
- 示例:查询值为12345678的uid所属的系统帐号的帐号ID | 类型 | 说明 |
| :-------------------- | :----------------------------------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是uid所属的系统帐号的帐号ID。 |
**示例:**查询值为12345678的uid所属的系统帐号的帐号ID
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -685,20 +772,24 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt; ...@@ -685,20 +772,24 @@ getOsAccountLocalIdFromUid(uid: number): Promise&lt;number&gt;
}); });
``` ```
### getOsAccountLocalIdFromDomain ### getOsAccountLocalIdFromDomain<sup>8+</sup>
getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;number&gt;): void getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;number&gt;): void
根据域帐号信息,获取与其关联的系统帐号的帐号ID。 根据域帐号信息,获取与其关联的系统帐号的帐号ID。
- 参数: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | --------------------- | ---- | --------------------------------------- |
| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是和域帐号关联的系统帐号ID。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| ---------- | --------------------------------------- | ---- | -------------------------------------------- |
| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是和域帐号关联的系统帐号ID。 |
**示例:**
``` ```
var domainInfo = {domain: "testDomain", accountName: "testAccountName"}; var domainInfo = {domain: "testDomain", accountName: "testAccountName"};
...@@ -709,25 +800,29 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall ...@@ -709,25 +800,29 @@ getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCall
}); });
``` ```
### getOsAccountLocalIdFromDomain ### getOsAccountLocalIdFromDomain<sup>8+</sup>
getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number&gt; getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise&lt;number&gt;
根据域帐号信息,获取与其关联的系统帐号的帐号ID,使用Promise方式异步返回结果。 根据域帐号信息,获取与其关联的系统帐号的帐号ID,使用Promise方式异步返回结果。
- 参数: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------ | ------ | ---- | ------------- | | ---------- | --------------------------------------- | ---- | ------------ |
| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 | | domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :-------------- | :---------------------------------- | | :-------------------- | :----------------------------------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是和域帐号关联的系统帐号ID。 | | Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是和域帐号关联的系统帐号ID。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -745,13 +840,17 @@ queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void ...@@ -745,13 +840,17 @@ queryMaxOsAccountNumber(callback: AsyncCallback&lt;number&gt;): void
查询允许创建的系统帐号的最大数量,使用callback回调异步返回结果。 查询允许创建的系统帐号的最大数量,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| -------- | --------------------- | ---- | ---------------------------------- |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是允许创建的系统帐号的最大数量。 |
- 示例: **参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------------------------ |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是允许创建的系统帐号的最大数量。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -767,13 +866,17 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt; ...@@ -767,13 +866,17 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt;
查询允许创建的系统帐号的最大数量,使用Promise方式异步返回结果。 查询允许创建的系统帐号的最大数量,使用Promise方式异步返回结果。
- 返回值: 此接口为系统接口,三方应用不支持调用。
**系统能力:** SystemCapability.Account.OsAccount
**返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :-------------- | :---------------------------------- | | :-------------------- | :----------------------------------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是允许创建的系统帐号的最大数量。 | | Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是允许创建的系统帐号的最大数量。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -788,16 +891,20 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt; ...@@ -788,16 +891,20 @@ queryMaxOsAccountNumber(): Promise&lt;number&gt;
getOsAccountAllConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void getOsAccountAllConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
获取指定系统帐号的全部[约束](#系统帐号约束列表),使用callback回调异步返回结果。 获取指定系统帐号的全部约束,使用callback回调异步返回结果。
- 参数: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| -------- | ---------------------------- | ---- | ---------------------------------- |
| localId | number | 是 | 系统帐号ID。 |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 回调结果,返回的是该系统帐号的全部[约束](#系统帐号约束列表)。 |
- 示例:获取ID为100的系统帐号的全部[约束](#系统帐号约束列表) **参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------------------------------------ |
| localId | number | 是 | 系统帐号ID。 |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | 是 | 回调结果,返回的是该系统帐号的全部[约束](#系统帐号约束列表)。 |
**示例:**获取ID为100的系统帐号的全部约束
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -812,21 +919,25 @@ getOsAccountAllConstraints(localId: number, callback: AsyncCallback&lt;Array&lt; ...@@ -812,21 +919,25 @@ getOsAccountAllConstraints(localId: number, callback: AsyncCallback&lt;Array&lt;
getOsAccountAllConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt; getOsAccountAllConstraints(localId: number): Promise&lt;Array&lt;string&gt;&gt;
获取指定系统帐号的全部[约束](#系统帐号约束列表),使用Promise方式异步返回结果。 获取指定系统帐号的全部约束,使用Promise方式异步返回结果。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
- 参数: **系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ------- | ------ | ---- | ------------ |
| localId | number | 是 | 系统帐号ID。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------ |
| localId | number | 是 | 系统帐号ID。 |
| 类型 | 说明 | **返回值:**
| :--------------------- | :---------------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise实例,用于获取异步返回结果,返回的是该系统帐号的全部[约束](#系统帐号约束列表)。 |
- 示例:获取ID为100的系统帐号的全部[约束](#系统帐号约束列表) | 类型 | 说明 |
| :--------------------------------- | :----------------------------------------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise实例,用于获取异步返回结果,返回的是该系统帐号的全部[约束](#系统帐号约束列表)。 |
**示例:**获取ID为100的系统帐号的全部约束
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -844,13 +955,17 @@ queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;& ...@@ -844,13 +955,17 @@ queryAllCreatedOsAccounts(callback: AsyncCallback&lt;Array&lt;OsAccountInfo&gt;&
查询已创建的所有系统帐号的信息列表,使用callback回调异步返回结果。 查询已创建的所有系统帐号的信息列表,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | ----------------------------------- | ---- | -------------------------------- |
| callback | AsyncCallback&lt;Array&lt;[OsAccountInfo](#osaccountinfo)&gt;&gt; | 是 | 回调结果,返回的是已创建的所有系统帐号的信息列表。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------------------- |
| callback | AsyncCallback&lt;Array&lt;[OsAccountInfo](#osaccountinfo)&gt;&gt; | 是 | 回调结果,返回的是已创建的所有系统帐号的信息列表。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -866,13 +981,17 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt; ...@@ -866,13 +981,17 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt;
查询已创建的所有系统帐号的信息列表,使用Promise方式异步返回结果。 查询已创建的所有系统帐号的信息列表,使用Promise方式异步返回结果。
- 返回值: 此接口为系统接口,三方应用不支持调用。
**系统能力:** SystemCapability.Account.OsAccount
| 类型 | 说明 | **返回值:**
| :---------------------------- | :---------------------------------- |
| Promise&lt;Array&lt;[OsAccountInfo](#osaccountinfo)&gt;&gt; | Promise实例,用于获取异步返回结果,返回的是已创建的所有系统帐号的信息列表。 |
- 示例: | 类型 | 说明 |
| :---------------------------------------------------------- | :----------------------------------------------------------- |
| Promise&lt;Array&lt;[OsAccountInfo](#osaccountinfo)&gt;&gt; | Promise实例,用于获取异步返回结果,返回的是已创建的所有系统帐号的信息列表。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -883,19 +1002,21 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt; ...@@ -883,19 +1002,21 @@ queryAllCreatedOsAccounts(): Promise&lt;Array&lt;OsAccountInfo&gt;&gt;
}); });
``` ```
### queryActivatedOsAccountIds ### queryActivatedOsAccountIds<sup>8+</sup>
queryActivatedOsAccountIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void queryActivatedOsAccountIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): void
查询当前处于激活状态的系统帐号的ID列表,使用callback回调异步返回结果。 查询当前处于激活状态的系统帐号的ID列表,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------- | ---- | -------------------------------- | | -------- | ---------------------------------------- | ---- | ------------------------------------------------------ |
| callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | 是 | 回调结果,返回的是当前处于激活状态的系统帐号的ID列表。 | | callback | AsyncCallback&lt;Array&lt;number&gt;&gt; | 是 | 回调结果,返回的是当前处于激活状态的系统帐号的ID列表。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -908,19 +1029,21 @@ queryActivatedOsAccountIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;): ...@@ -908,19 +1029,21 @@ queryActivatedOsAccountIds(callback: AsyncCallback&lt;Array&lt;number&gt;&gt;):
}); });
``` ```
### queryActivatedOsAccountIds ### queryActivatedOsAccountIds<sup>8+</sup>
queryActivatedOsAccountIds(): Promise&lt;Array&lt;number&gt;&gt; queryActivatedOsAccountIds(): Promise&lt;Array&lt;number&gt;&gt;
查询当前处于激活状态的系统帐号的ID列表,使用Promise方式异步返回结果。 查询当前处于激活状态的系统帐号的ID列表,使用Promise方式异步返回结果。
- 返回值: **系统能力:** SystemCapability.Account.OsAccount
| 类型 | 说明 | **返回值:**
| :---------------------------- | :---------------------------------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise实例,用于获取异步返回结果,返回的是当前处于激活状态的系统帐号的ID列表。 |
- 示例: | 类型 | 说明 |
| :--------------------------------- | :----------------------------------------------------------- |
| Promise&lt;Array&lt;number&gt;&gt; | Promise实例,用于获取异步返回结果,返回的是当前处于激活状态的系统帐号的ID列表。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -937,15 +1060,21 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback& ...@@ -937,15 +1060,21 @@ createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback&
创建一个系统帐号,使用callback回调异步返回结果。 创建一个系统帐号,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| :-------- | ---------------------------- | ---- | -------------------- |
| localName | string | 是 | 创建的系统帐号的名称。 |
| type | [OsAccountType](#osaccounttype) | 是 | 创建的系统帐号的类型。 |
| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | 是 | 回调结果,返回的是新创建的系统帐号的信息。 |
- 示例: **参数:**
| 参数名 | 类型 | 必填 | 说明 |
| :-------- | ---------------------------------------------------- | ---- | ------------------------------------------ |
| localName | string | 是 | 创建的系统帐号的名称。 |
| type | [OsAccountType](#osaccounttype) | 是 | 创建的系统帐号的类型。 |
| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | 是 | 回调结果,返回的是新创建的系统帐号的信息。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -961,20 +1090,26 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf ...@@ -961,20 +1090,26 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf
创建一个系统帐号,使用Promise方式异步返回结果。 创建一个系统帐号,使用Promise方式异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| --------- | ------------- | ---- | ---------------- |
| localName | string | 是 | 创建的系统帐号的名称。 |
| type | [OsAccountType](#osaccounttype) | 是 | 创建的系统帐号的类型。 |
- 返回值: | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------------------------- | ---- | ---------------------- |
| localName | string | 是 | 创建的系统帐号的名称。 |
| type | [OsAccountType](#osaccounttype) | 是 | 创建的系统帐号的类型。 |
| 类型 | 说明 | **返回值:**
| :--------------------- | :---------------------------------- |
| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise实例,用于获取异步返回结果,返回的是新创建的系统帐号的信息。 |
- 示例: | 类型 | 说明 |
| :--------------------------------------------- | :----------------------------------------------------------- |
| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise实例,用于获取异步返回结果,返回的是新创建的系统帐号的信息。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -985,21 +1120,27 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf ...@@ -985,21 +1120,27 @@ createOsAccount(localName: string, type: OsAccountType): Promise&lt;OsAccountInf
}); });
``` ```
### createOsAccountForDomain ### createOsAccountForDomain<sup>8+</sup>
createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;OsAccountInfo&gt;): void createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback&lt;OsAccountInfo&gt;): void
根据域帐号信息,创建一个系统帐号并将其与域帐号关联,使用callback回调异步返回结果。 根据域帐号信息,创建一个系统帐号并将其与域帐号关联,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| :-------- | ---------------------------- | ---- | -------------------- |
| type | [OsAccountType](#osaccounttype) | 是 | 创建的系统帐号的类型。 |
| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 |
| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | 是 | 回调结果,返回的是新创建的系统帐号的信息。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| :--------- | ---------------------------------------------------- | ---- | ------------------------------------------ |
| type | [OsAccountType](#osaccounttype) | 是 | 创建的系统帐号的类型。 |
| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 |
| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | 是 | 回调结果,返回的是新创建的系统帐号的信息。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1010,26 +1151,32 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal ...@@ -1010,26 +1151,32 @@ createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, cal
}); });
``` ```
### createOsAccountForDomain ### createOsAccountForDomain<sup>8+</sup>
createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise&lt;OsAccountInfo&gt; createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise&lt;OsAccountInfo&gt;
根据传入的域帐号信息,创建与其关联的系统帐号,使用Promise方式异步返回结果。 根据传入的域帐号信息,创建与其关联的系统帐号,使用Promise方式异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------- | ---- | ---------------- | | ---------- | --------------------------------------- | ---- | ---------------------- |
| type | [OsAccountType](#osaccounttype) | 是 | 创建的系统帐号的类型。 | | type | [OsAccountType](#osaccounttype) | 是 | 创建的系统帐号的类型。 |
| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 | | domainInfo | [DomainAccountInfo](#domainaccountinfo) | 是 | 域帐号信息。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :--------------------- | :---------------------------------- | | :--------------------------------------------- | :----------------------------------------------------------- |
| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise实例,用于获取异步返回结果,返回的是新创建的系统帐号的信息。 | | Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise实例,用于获取异步返回结果,返回的是新创建的系统帐号的信息。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1047,13 +1194,17 @@ queryCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void ...@@ -1047,13 +1194,17 @@ queryCurrentOsAccount(callback: AsyncCallback&lt;OsAccountInfo&gt;): void
查询当前进程所属的系统帐号的信息,使用callback回调异步返回结果。 查询当前进程所属的系统帐号的信息,使用callback回调异步返回结果。
- 参数: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| -------- | ---------------------------- | ---- | -------------------------- |
| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | 是 | 回调结果,返回的是当前进程所属的系统帐号信息。 |
- 示例: **参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | 是 | 回调结果,返回的是当前进程所属的系统帐号信息。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1069,13 +1220,17 @@ queryCurrentOsAccount(): Promise&lt;OsAccountInfo&gt; ...@@ -1069,13 +1220,17 @@ queryCurrentOsAccount(): Promise&lt;OsAccountInfo&gt;
查询当前进程所属的系统帐号的信息,使用Promise方式异步返回结果。 查询当前进程所属的系统帐号的信息,使用Promise方式异步返回结果。
- 返回值: **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
**返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :--------------------- | :---------------------------------- | | :--------------------------------------------- | :----------------------------------------------------------- |
| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise实例,用于获取异步返回结果,返回的是当前进程所属的系统帐号信息。 | | Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise实例,用于获取异步返回结果,返回的是当前进程所属的系统帐号信息。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1092,14 +1247,20 @@ queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt; ...@@ -1092,14 +1247,20 @@ queryOsAccountById(localId: number, callback: AsyncCallback&lt;OsAccountInfo&gt;
查询指定系统帐号的信息,使用callback回调异步返回结果。 查询指定系统帐号的信息,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
| 参数名 | 类型 | 必填 | 说明 | **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS、ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
| -------- | ---------------------------- | ---- | -------------------------- |
| localId | number | 是 | 要查询的系统帐号的ID |
| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | 是 | 回调结果,返回的是查到的系统帐号的信息。 |
- 示例:查询ID为100的系统帐号信息 **系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------------- | ---- | ---------------------------------------- |
| localId | number | 是 | 要查询的系统帐号的ID |
| callback | AsyncCallback&lt;[OsAccountInfo](#osaccountinfo)&gt; | 是 | 回调结果,返回的是查到的系统帐号的信息。 |
**示例:**查询ID为100的系统帐号信息
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1116,19 +1277,25 @@ queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt; ...@@ -1116,19 +1277,25 @@ queryOsAccountById(localId: number): Promise&lt;OsAccountInfo&gt;
查询指定系统帐号的信息,使用Promise方式异步返回结果。 查询指定系统帐号的信息,使用Promise方式异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS、ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| -------- | ---------------------------- | ---- | -------------------------- |
| localId | number | 是 | 要查询的系统帐号的ID |
- 返回值: **参数:**
| 类型 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| :--------------------- | :---------------------------------- | | ------- | ------ | ---- | -------------------- |
| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise实例,用于获取异步返回结果,返回的是查到的系统帐号的信息。 | | localId | number | 是 | 要查询的系统帐号的ID |
- 示例:查询ID为100的系统帐号信息 **返回值:**
| 类型 | 说明 |
| :--------------------------------------------- | :----------------------------------------------------------- |
| Promise&lt;[OsAccountInfo](#osaccountinfo)&gt; | Promise实例,用于获取异步返回结果,返回的是查到的系统帐号的信息。 |
**示例:**查询ID为100的系统帐号信息
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1146,13 +1313,15 @@ getOsAccountTypeFromProcess(callback: AsyncCallback&lt;OsAccountType&gt;): void ...@@ -1146,13 +1313,15 @@ getOsAccountTypeFromProcess(callback: AsyncCallback&lt;OsAccountType&gt;): void
查询当前进程所属的系统帐号的帐号类型,使用callback回调异步返回结果。 查询当前进程所属的系统帐号的帐号类型,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------- | ---- | ---------------------------------------- | | -------- | ---------------------------------------------------- | ---- | ---------------------------------------------------- |
| callback | AsyncCallback&lt;[OsAccountType](#osaccounttype)&gt; | 是 | 回调结果,返回的是当前进程所属的系统帐号的帐号类型。 | | callback | AsyncCallback&lt;[OsAccountType](#osaccounttype)&gt; | 是 | 回调结果,返回的是当前进程所属的系统帐号的帐号类型。 |
- 示例: **示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1168,13 +1337,15 @@ getOsAccountTypeFromProcess(): Promise&lt;OsAccountType&gt; ...@@ -1168,13 +1337,15 @@ getOsAccountTypeFromProcess(): Promise&lt;OsAccountType&gt;
查询当前进程所属的系统帐号的帐号类型,使用Promise方式异步返回结果。 查询当前进程所属的系统帐号的帐号类型,使用Promise方式异步返回结果。
- 返回值: **系统能力:** SystemCapability.Account.OsAccount
| 类型 | 说明 | **返回值:**
| :--------------------- | :---------------------------------- |
| Promise&lt;[OsAccountType](#osaccounttype)&gt; | Promise实例,用于获取异步返回结果,返回的是当前进程所属的系统帐号的帐号类型。 |
- 示例: | 类型 | 说明 |
| :--------------------------------------------- | :----------------------------------------------------------- |
| Promise&lt;[OsAccountType](#osaccounttype)&gt; | Promise实例,用于获取异步返回结果,返回的是当前进程所属的系统帐号的帐号类型。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1191,13 +1362,17 @@ getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void ...@@ -1191,13 +1362,17 @@ getDistributedVirtualDeviceId(callback: AsyncCallback&lt;string&gt;): void
获取分布式虚拟设备ID,使用callback回调异步返回结果。 获取分布式虚拟设备ID,使用callback回调异步返回结果。
- 参数: **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
**系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | --------------------- | ---- | ---------------------------- |
| callback | AsyncCallback&lt;string&gt; | 是 | 回调结果,返回的是分布式虚拟设备ID。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback&lt;string&gt; | 是 | 回调结果,返回的是分布式虚拟设备ID。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1213,13 +1388,17 @@ getDistributedVirtualDeviceId(): Promise&lt;string&gt; ...@@ -1213,13 +1388,17 @@ getDistributedVirtualDeviceId(): Promise&lt;string&gt;
获取分布式虚拟设备ID,使用Promise方式异步返回结果。 获取分布式虚拟设备ID,使用Promise方式异步返回结果。
- 返回值: **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
**系统能力:** SystemCapability.Account.OsAccount
| 类型 | 说明 | **返回值:**
| :-------------- | :---------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果,返回的是分布式虚拟设备ID。 |
- 示例: | 类型 | 说明 |
| :-------------------- | :----------------------------------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果,返回的是分布式虚拟设备ID。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1236,14 +1415,20 @@ getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;) ...@@ -1236,14 +1415,20 @@ getOsAccountProfilePhoto(localId: number, callback: AsyncCallback&lt;string&gt;)
获取指定系统帐号的头像信息,使用callback回调异步返回结果。 获取指定系统帐号的头像信息,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
**系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------ | | -------- | --------------------------- | ---- | ---------------------------------------- |
| localId | number | 是 | 系统帐号ID。 | | localId | number | 是 | 系统帐号ID。 |
| callback | AsyncCallback&lt;string&gt; | 是 | 回调结果,返回的是该系统帐号的头像信息。 | | callback | AsyncCallback&lt;string&gt; | 是 | 回调结果,返回的是该系统帐号的头像信息。 |
- 示例:获取ID为100的系统帐号的头像 **示例:**获取ID为100的系统帐号的头像
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1260,19 +1445,25 @@ getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt; ...@@ -1260,19 +1445,25 @@ getOsAccountProfilePhoto(localId: number): Promise&lt;string&gt;
获取指定系统帐号的头像信息,使用Promise方式异步返回结果。 获取指定系统帐号的头像信息,使用Promise方式异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
| 参数名 | 类型 | 必填 | 说明 | **需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
| ------- | ------ | ---- | ------------ |
| localId | number | 是 | 系统帐号ID。 |
- 返回值: **系统能力:** SystemCapability.Account.OsAccount
| 类型 | 说明 | **参数:**
| :-------------- | :---------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果,返回的是该系统帐号的头像信息。 |
- 示例:获取ID为100的系统帐号的头像 | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------ |
| localId | number | 是 | 系统帐号ID。 |
**返回值:**
| 类型 | 说明 |
| :-------------------- | :----------------------------------------------------------- |
| Promise&lt;string&gt; | Promise实例,用于获取异步返回结果,返回的是该系统帐号的头像信息。 |
**示例:**获取ID为100的系统帐号的头像
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1290,15 +1481,21 @@ setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback ...@@ -1290,15 +1481,21 @@ setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback
为指定系统帐号设置头像信息,使用callback回调异步返回结果。 为指定系统帐号设置头像信息,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| -------- | ------------------- | ---- | ------------------------ |
| localId | number | 是 | 系统帐号ID。 |
| photo | string | 是 | 头像信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 |
- 示例:给ID为100的系统帐号设置头像 **参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------ |
| localId | number | 是 | 系统帐号ID。 |
| photo | string | 是 | 头像信息。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调结果。 |
**示例:**给ID为100的系统帐号设置头像
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1318,20 +1515,26 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt; ...@@ -1318,20 +1515,26 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt;
为指定系统帐号设置头像信息,使用Promise方式异步返回结果。 为指定系统帐号设置头像信息,使用Promise方式异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| ------- | ------ | ---- | ------------ |
| localId | number | 是 | 系统帐号ID。 |
| photo | string | 是 | 头像信息。 |
- 返回值: **参数:**
| 类型 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| :------------ | :---------------------------------- | | ------- | ------ | ---- | ------------ |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 | | localId | number | 是 | 系统帐号ID。 |
| photo | string | 是 | 头像信息。 |
- 示例:给ID为100的系统帐号设置头像 **返回值:**
| 类型 | 说明 |
| :------------------ | :---------------------------------- |
| Promise&lt;void&gt; | Promise实例,用于获取异步返回结果。 |
**示例:**给ID为100的系统帐号设置头像
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1347,20 +1550,22 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt; ...@@ -1347,20 +1550,22 @@ setOsAccountProfilePhoto(localId: number, photo: string): Promise&lt;void&gt;
}); });
``` ```
### getOsAccountLocalIdBySerialNumber ### getOsAccountLocalIdBySerialNumber<sup>8+</sup>
getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback&lt;number&gt;): void getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback&lt;number&gt;): void
通过SN码查询与其关联的系统帐号的帐号ID,使用callback回调异步返回结果。 通过SN码查询与其关联的系统帐号的帐号ID,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| ------------ | --------------------- | ---- | ------------------------------ |
| serialNumber | number | 是 | 帐号SN码。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是与SN码关联的系统帐号的帐号ID。 |
- 示例:查询与SN码12345关联的系统帐号的ID | 参数名 | 类型 | 必填 | 说明 |
| ------------ | --------------------------- | ---- | ------------------------------------------------ |
| serialNumber | number | 是 | 帐号SN码。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是与SN码关联的系统帐号的帐号ID。 |
**示例:**查询与SN码12345关联的系统帐号的ID
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1371,25 +1576,27 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback& ...@@ -1371,25 +1576,27 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback&
}); });
``` ```
### getOsAccountLocalIdBySerialNumber ### getOsAccountLocalIdBySerialNumber<sup>8+</sup>
getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt; getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt;
通过SN码查询与其关联的系统帐号的帐号ID,使用Promise方式异步返回结果。 通过SN码查询与其关联的系统帐号的帐号ID,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------------ | ------ | ---- | ---------- | | ------------ | ------ | ---- | ---------- |
| serialNumber | number | 是 | 帐号SN码。 | | serialNumber | number | 是 | 帐号SN码。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :-------------- | :---------------------------------- | | :-------------------- | :----------------------------------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是与SN码关联的系统帐号的帐号ID。 | | Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是与SN码关联的系统帐号的帐号ID。 |
- 示例:查询与SN码12345关联的系统帐号的ID **示例:**查询与SN码12345关联的系统帐号的ID
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1401,20 +1608,22 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt; ...@@ -1401,20 +1608,22 @@ getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise&lt;number&gt;
}); });
``` ```
### getSerialNumberByOsAccountLocalId ### getSerialNumberByOsAccountLocalId<sup>8+</sup>
getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback&lt;number&gt;): void getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback&lt;number&gt;): void
通过系统帐号ID获取与该系统帐号关联的SN码,使用callback回调异步返回结果。 通过系统帐号ID获取与该系统帐号关联的SN码,使用callback回调异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | --------------------- | ---- | ------------------------------ |
| localId | number | 是 | 系统帐号ID。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是与该系统帐号关联的SN码。 |
- 示例:获取ID为100的系统帐号关联的SN码 | 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------- | ---- | ------------------------------------------ |
| localId | number | 是 | 系统帐号ID。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调结果,返回的是与该系统帐号关联的SN码。 |
**示例:**获取ID为100的系统帐号关联的SN码
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1425,25 +1634,27 @@ getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback&lt;nu ...@@ -1425,25 +1634,27 @@ getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback&lt;nu
}); });
``` ```
### getSerialNumberByOsAccountLocalId ### getSerialNumberByOsAccountLocalId<sup>8+</sup>
getSerialNumberByOsAccountLocalId(localId: number): Promise&lt;number&gt; getSerialNumberByOsAccountLocalId(localId: number): Promise&lt;number&gt;
通过系统帐号ID获取与该系统帐号关联的SN码,使用Promise方式异步返回结果。 通过系统帐号ID获取与该系统帐号关联的SN码,使用Promise方式异步返回结果。
- 参数: **系统能力:** SystemCapability.Account.OsAccount
**参数:**
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| ------- | ------ | ---- | ------------ | | ------- | ------ | ---- | ------------ |
| localId | number | 是 | 系统帐号ID。 | | localId | number | 是 | 系统帐号ID。 |
- 返回值: **返回值:**
| 类型 | 说明 | | 类型 | 说明 |
| :-------------- | :---------------------------------- | | :-------------------- | :----------------------------------------------------------- |
| Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是与该系统帐号关联的SN码。 | | Promise&lt;number&gt; | Promise实例,用于获取异步返回结果,返回的是与该系统帐号关联的SN码。 |
- 示例:获取ID为100的系统帐号关联的SN码 **示例:**获取ID为100的系统帐号关联的SN码
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1461,15 +1672,21 @@ on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&g ...@@ -1461,15 +1672,21 @@ on(type: 'activate' | 'activating', name: string, callback: Callback&lt;number&g
订阅系统帐号的变动信息,使用callback回调异步返回结果。 订阅系统帐号的变动信息,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
| 参数名 | 类型 | 必填 | 说明 | **系统能力:** SystemCapability.Account.OsAccount
| -------- | -------------------------- | ---- | ------------------------ |
| type | 'activate' \| 'activating' | 是 | 订阅类型,activate表示订阅的是帐号已激活完成的事件,activating表示订阅的是帐号正在激活的事件。 |
| name | string | 是 | 订阅名称,可自定义,要求非空且长度不超过1024字节。|
| callback | Callback&lt;number&gt; | 是 | 订阅系统帐号变动信息的回调,表示当前事件对应的系统帐号ID。 |
- 示例: **参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
| type | 'activate' \| 'activating' | 是 | 订阅类型,activate表示订阅的是帐号已激活完成的事件,activating表示订阅的是帐号正在激活的事件。 |
| name | string | 是 | 订阅名称,可自定义,要求非空且长度不超过1024字节。 |
| callback | Callback&lt;number&gt; | 是 | 订阅系统帐号变动信息的回调,表示当前事件对应的系统帐号ID。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1485,15 +1702,21 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number ...@@ -1485,15 +1702,21 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number
取消订阅系统帐号的变动信息,使用callback回调异步返回结果。 取消订阅系统帐号的变动信息,使用callback回调异步返回结果。
- 参数: 此接口为系统接口,三方应用不支持调用。
**需要权限:** ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION
**系统能力:** SystemCapability.Account.OsAccount
| 参数名 | 类型 | 必填 | 说明 | **参数:**
| -------- | -------------------------- | ---- | ---------------------------- |
| type | 'activate' \| 'activating' | 是 | 取消订阅类型,activate表示取消订阅帐号已激活完成的事件,activating取消订阅帐号正在激活的事件。 |
| name | string | 是 | 订阅名称,可自定义,,要求非空且长度不超过1024字节,需要与订阅接口传入的值保持一致。 |
| callback | Callback&lt;number&gt; | 否 | 取消订阅系统帐号变化的回调,默认返回0。 |
- 示例: | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------------- | ---- | ------------------------------------------------------------ |
| type | 'activate' \| 'activating' | 是 | 取消订阅类型,activate表示取消订阅帐号已激活完成的事件,activating取消订阅帐号正在激活的事件。 |
| name | string | 是 | 订阅名称,可自定义,,要求非空且长度不超过1024字节,需要与订阅接口传入的值保持一致。 |
| callback | Callback&lt;number&gt; | 否 | 取消订阅系统帐号变化的回调,默认返回0。 |
**示例:**
``` ```
const accountManager = account_osAccount.getAccountManager(); const accountManager = account_osAccount.getAccountManager();
...@@ -1504,45 +1727,51 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number ...@@ -1504,45 +1727,51 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number
``` ```
## OsAccountInfo ## OsAccountInfo
系统帐号信息 系统帐号信息。
| 参数名 | 类型 | 必填 | 说明 |
| ----------------- | ---------------------------------- | ---- | ------------------------ | **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount。
| localId | number | 是 | 系统帐号ID。 |
| localName | string | 是 | 系统帐号名称。 | | 参数名 | 类型 | 必填 | 说明 |
| type | [OsAccountType](#osaccounttype) | 是 | 系统帐号类型 | | ----------------- | ------------------------------------------------------------ | ---- | --------------------------------- |
| constraints | Array&lt;string&gt; | 否 | 系统帐号[约束](#系统帐号约束列表) | | localId | number | 是 | 系统帐号ID。 |
| isVerified | boolean | 是 | 帐号是否锁屏 | | localName | string | 是 | 系统帐号名称。 |
| photo | string | 否 | 系统帐号头像 | | type | [OsAccountType](#osaccounttype) | 是 | 系统帐号类型 |
| createTime | number | 是 | 系统帐号创建时间 | | constraints | Array&lt;string&gt; | 否 | 系统帐号[约束](#系统帐号约束列表) |
| lastLoginTime | number | 否 | 系统帐号最后一次登录时间 | | isVerified | boolean | 是 | 帐号是否锁屏 |
| serialNumber | number | 是 | 系统帐号SN码 | | photo | string | 否 | 系统帐号头像 |
| isActived | boolean | 是 | 系统帐号激活状态 | | createTime | number | 是 | 系统帐号创建时间 |
| isCreateCompleted | boolean | 是 | 系统帐号创建是否完整 | | lastLoginTime | number | 否 | 系统帐号最后一次登录时间 |
| distributedInfo | [distributedAccount.DistributedInfo](js-apis-distributed-account.md) | 否 | 分布式帐号信息 | | serialNumber | number | 是 | 系统帐号SN码 |
| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 否 | 域帐号信息 | | isActived | boolean | 是 | 系统帐号激活状态 |
| isCreateCompleted | boolean | 是 | 系统帐号创建是否完整 |
| distributedInfo | [distributedAccount.DistributedInfo](js-apis-distributed-account.md) | 否 | 分布式帐号信息 |
| domainInfo | [DomainAccountInfo](#domainaccountinfo) | 否 | 域帐号信息 |
## DomainAccountInfo ## DomainAccountInfo
域帐号信息 域帐号信息。
| 参数名 | 类型 | 必填 | 说明 |
| ----------------- | ---------------------------------- | ---- | ------------------------ | **系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount。
| domain | string | 是 | 域名。 |
| accountName | string | 是 | 域帐号名。 | | 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------ | ---- | ---------- |
| domain | string | 是 | 域名。 |
| accountName | string | 是 | 域帐号名。 |
## 系统帐号约束列表 ## 系统帐号约束列表
| 约束 | 说明 | | 约束 | 说明 |
| ----------------- | ------------------- | | ------------------------------------- | ------------------------------ |
| constraint.wifi | 禁止使用wifi | | constraint.wifi | 禁止使用wifi |
| constraint.wifi.set | 禁止配置wifi | | constraint.wifi.set | 禁止配置wifi |
| constraint.locale.set | 禁止配置设备语言 | | constraint.locale.set | 禁止配置设备语言 |
| constraint.app.accounts | 禁止添加和删除应用帐号 | | constraint.app.accounts | 禁止添加和删除应用帐号 |
| constraint.apps.install | 禁止安装应用 | | constraint.apps.install | 禁止安装应用 |
| constraint.apps.uninstall | 禁止卸载应用 | | constraint.apps.uninstall | 禁止卸载应用 |
| constraint.location.shared | 禁止打开位置共享 | | constraint.location.shared | 禁止打开位置共享 |
| constraint.unknown.sources.install | 禁止安装未知来源的应用 | | constraint.unknown.sources.install | 禁止安装未知来源的应用 |
| constraint.global.unknown.app.install | 禁止所有用户安装未知来源的应用 | | constraint.global.unknown.app.install | 禁止所有用户安装未知来源的应用 |
| constraint.bluetooth.set | 禁止配置蓝牙 | | constraint.bluetooth.set | 禁止配置蓝牙 |
| constraint.bluetooth | 禁止使用蓝牙 | constraint.bluetooth | 禁止使用蓝牙 |
| constraint.bluetooth.share | 禁止共享使用蓝牙 | | constraint.bluetooth.share | 禁止共享使用蓝牙 |
| constraint.usb.file.transfer | 禁止通过USB传输文件 | | constraint.usb.file.transfer | 禁止通过USB传输文件 |
| constraint.credentials.set | 禁止配置用户凭据 | | constraint.credentials.set | 禁止配置用户凭据 |
...@@ -1594,4 +1823,4 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number ...@@ -1594,4 +1823,4 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback&lt;number
| constraint.ambient.display | 禁止显示环境 | | constraint.ambient.display | 禁止显示环境 |
| constraint.screen.timeout.set | 禁止配置屏幕关闭的超时 | | constraint.screen.timeout.set | 禁止配置屏幕关闭的超时 |
| constraint.print | 禁止打印 | | constraint.print | 禁止打印 |
| constraint.private.dns.set | 禁止配置专用DNS | | constraint.private.dns.set | 禁止配置专用DNS |
\ No newline at end of file
...@@ -121,7 +121,7 @@ child.getErrorOutput.then(val=>{ ...@@ -121,7 +121,7 @@ child.getErrorOutput.then(val=>{
### close ### close
close(): void close(): void
关闭正在运行的子进程。 关闭正在运行的子进程。
...@@ -180,7 +180,7 @@ var result = process.isIsolatedProcess(); ...@@ -180,7 +180,7 @@ var result = process.isIsolatedProcess();
## process.isAppUid<sup>8+</sup> ## process.isAppUid<sup>8+</sup>
isAppUid(v:number): boolean isAppUid(v: number): boolean
判断uid是否属于应用程序。 判断uid是否属于应用程序。
...@@ -228,7 +228,7 @@ var ressult = process.is64Bit(); ...@@ -228,7 +228,7 @@ var ressult = process.is64Bit();
## process.getUidForName<sup>8+</sup> ## process.getUidForName<sup>8+</sup>
getUidForName(v:string): number getUidForName(v: string): number
通过进程名获取进程uid。 通过进程名获取进程uid。
...@@ -255,7 +255,7 @@ var pres = process.getUidForName("tool") ...@@ -255,7 +255,7 @@ var pres = process.getUidForName("tool")
## process.getThreadPriority<sup>8+</sup> ## process.getThreadPriority<sup>8+</sup>
getThreadPriority(v:number): number getThreadPriority(v: number): number
根据指定的tid获取线程优先级。 根据指定的tid获取线程优先级。
...@@ -324,7 +324,7 @@ var result = process.getPastCpuTime() ; ...@@ -324,7 +324,7 @@ var result = process.getPastCpuTime() ;
## process.getSystemConfig<sup>8+</sup> ## process.getSystemConfig<sup>8+</sup>
getSystemConfig(name:number): number getSystemConfig(name: number): number
获取系统配置信息。 获取系统配置信息。
...@@ -352,7 +352,7 @@ var pres = process.getSystemConfig(_SC_ARG_MAX) ...@@ -352,7 +352,7 @@ var pres = process.getSystemConfig(_SC_ARG_MAX)
## process.getEnvironmentVar<sup>8+</sup> ## process.getEnvironmentVar<sup>8+</sup>
getEnvironmentVar(name:string): string getEnvironmentVar(name: string): string
用该方法获取环境变量对应的值。 用该方法获取环境变量对应的值。
...@@ -451,7 +451,7 @@ on(type: string, listener: EventListener): void ...@@ -451,7 +451,7 @@ on(type: string, listener: EventListener): void
| 名称 | 说明 | | 名称 | 说明 |
| -------- | -------- | | -------- | -------- |
| EventListener&nbsp;=&nbsp;(evt:&nbsp;Object)&nbsp;=&gt;&nbsp;void | 用户存储的事件。 | | EventListener&nbsp;=&nbsp;(evt: &nbsp;Object)&nbsp;=&gt;&nbsp;void | 用户存储的事件。 |
**示例:** **示例:**
......
...@@ -1708,8 +1708,8 @@ readException(): void ...@@ -1708,8 +1708,8 @@ readException(): void
} }
}; };
let want = { let want = {
"bundleName": "com.huawei.server", "bundleName": "com.ohos.server",
"abilityName": "com.huawei.server.MainAbility", "abilityName": "com.ohos.server.MainAbility",
}; };
FA.connectAbility(want, connect); FA.connectAbility(want, connect);
let option = new rpc.MessageOption(); let option = new rpc.MessageOption();
...@@ -2563,8 +2563,8 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options ...@@ -2563,8 +2563,8 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options
} }
}; };
let want = { let want = {
"bundleName": "com.huawei.server", "bundleName": "com.ohos.server",
"abilityName": "com.huawei.server.MainAbility", "abilityName": "com.ohos.server.MainAbility",
}; };
FA.connectAbility(want, connect); FA.connectAbility(want, connect);
let option = new rpc.MessageOption(); let option = new rpc.MessageOption();
...@@ -2608,8 +2608,8 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options ...@@ -2608,8 +2608,8 @@ sendRequest(code : number, data : MessageParcel, reply : MessageParcel, options
} }
}; };
let want = { let want = {
"bundleName": "com.huawei.server", "bundleName": "com.ohos.server",
"abilityName": "com.huawei.server.MainAbility", "abilityName": "com.ohos.server.MainAbility",
}; };
FA.connectAbility(want, connect); FA.connectAbility(want, connect);
let option = new rpc.MessageOption(); let option = new rpc.MessageOption();
...@@ -2672,8 +2672,8 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me ...@@ -2672,8 +2672,8 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me
} }
}; };
let want = { let want = {
"bundleName": "com.huawei.server", "bundleName": "com.ohos.server",
"abilityName": "com.huawei.server.MainAbility", "abilityName": "com.ohos.server.MainAbility",
}; };
function sendRequestCallback(result) { function sendRequestCallback(result) {
if (result.errCode === 0) { if (result.errCode === 0) {
...@@ -2734,8 +2734,8 @@ queryLocalInterface(interface: string): IRemoteBroker ...@@ -2734,8 +2734,8 @@ queryLocalInterface(interface: string): IRemoteBroker
} }
}; };
let want = { let want = {
"bundleName":"com.huawei.server", "bundleName":"com.ohos.server",
"abilityName":"com.huawei.server.MainAbility", "abilityName":"com.ohos.server.MainAbility",
}; };
FA.connectAbility(want, connect); FA.connectAbility(want, connect);
let broker = proxy.queryLocalInterface("testObject"); let broker = proxy.queryLocalInterface("testObject");
...@@ -2780,8 +2780,8 @@ addDeathRecipient(recipient : DeathRecipient, flags : number): boolean ...@@ -2780,8 +2780,8 @@ addDeathRecipient(recipient : DeathRecipient, flags : number): boolean
} }
}; };
let want = { let want = {
"bundleName": "com.huawei.server", "bundleName": "com.ohos.server",
"abilityName": "com.huawei.server.MainAbility", "abilityName": "com.ohos.server.MainAbility",
}; };
FA.connectAbility(want, connect); FA.connectAbility(want, connect);
class MyDeathRecipient { class MyDeathRecipient {
...@@ -2831,8 +2831,8 @@ removeDeathRecipient(recipient : DeathRecipient, flags : number): boolean ...@@ -2831,8 +2831,8 @@ removeDeathRecipient(recipient : DeathRecipient, flags : number): boolean
} }
}; };
let want = { let want = {
"bundleName": "com.huawei.server", "bundleName": "com.ohos.server",
"abilityName": "com.huawei.server.MainAbility", "abilityName": "com.ohos.server.MainAbility",
}; };
FA.connectAbility(want, connect); FA.connectAbility(want, connect);
class MyDeathRecipient { class MyDeathRecipient {
...@@ -2877,8 +2877,8 @@ getInterfaceDescriptor(): string ...@@ -2877,8 +2877,8 @@ getInterfaceDescriptor(): string
} }
}; };
let want = { let want = {
"bundleName": "com.huawei.server", "bundleName": "com.ohos.server",
"abilityName": "com.huawei.server.MainAbility", "abilityName": "com.ohos.server.MainAbility",
}; };
FA.connectAbility(want, connect); FA.connectAbility(want, connect);
let descriptor = proxy.getInterfaceDescriptor(); let descriptor = proxy.getInterfaceDescriptor();
...@@ -2917,8 +2917,8 @@ isObjectDead(): boolean ...@@ -2917,8 +2917,8 @@ isObjectDead(): boolean
} }
}; };
let want = { let want = {
"bundleName": "com.huawei.server", "bundleName": "com.ohos.server",
"abilityName": "com.huawei.server.MainAbility", "abilityName": "com.ohos.server.MainAbility",
}; };
FA.connectAbility(want, connect); FA.connectAbility(want, connect);
let isDead = proxy.isObjectDead(); let isDead = proxy.isObjectDead();
......
...@@ -416,9 +416,9 @@ setTimezone(timezone: string): Promise&lt;void&gt; ...@@ -416,9 +416,9 @@ setTimezone(timezone: string): Promise&lt;void&gt;
``` ```
## systemTime.getTimeZone<sup>8+</sup> ## systemTime.getTimezone<sup>8+</sup>
getTimeZone(callback: AsyncCallback&lt;string&gt;): void getTimezone(callback: AsyncCallback&lt;string&gt;): void
获取系统时区,使用callback形式返回结果。 获取系统时区,使用callback形式返回结果。
...@@ -432,19 +432,19 @@ getTimeZone(callback: AsyncCallback&lt;string&gt;): void ...@@ -432,19 +432,19 @@ getTimeZone(callback: AsyncCallback&lt;string&gt;): void
- 示例: - 示例:
``` ```
systemTime.getTimeZone((error, data) => { systemTime.getTimezone((error, data) => {
if (error) { if (error) {
console.error(`failed to systemTime.getTimeZone because ` + JSON.stringify(error)); console.error(`failed to systemTime.getTimezone because ` + JSON.stringify(error));
return; return;
} }
console.log(`systemTime.getTimeZone success data : ` + JSON.stringify(data)); console.log(`systemTime.getTimezone success data : ` + JSON.stringify(data));
}); });
``` ```
## systemTime.getTimeZone<sup>8+</sup> ## systemTime.getTimezone<sup>8+</sup>
getTimeZone(): Promise&lt;string&gt; getTimezone(): Promise&lt;string&gt;
获取系统时区,使用Promise形式返回结果。 获取系统时区,使用Promise形式返回结果。
...@@ -458,9 +458,9 @@ getTimeZone(): Promise&lt;string&gt; ...@@ -458,9 +458,9 @@ getTimeZone(): Promise&lt;string&gt;
- 示例: - 示例:
``` ```
systemTime.getDate().then((data) => { systemTime.getTimezone().then((data) => {
console.log(`systemTime.getTimeZone success data : ` + JSON.stringify(data)); console.log(`systemTime.getTimezone success data : ` + JSON.stringify(data));
}).catch((error) => { }).catch((error) => {
console.error(`failed to systemTime.getTimeZone because ` + JSON.stringify(error)); console.error(`failed to systemTime.getTimezone because ` + JSON.stringify(error));
}); });
``` ```
...@@ -147,7 +147,7 @@ promiseWrapper(original: (err: Object, value: Object) =&gt; void): Object ...@@ -147,7 +147,7 @@ promiseWrapper(original: (err: Object, value: Object) =&gt; void): Object
### constructor ### constructor
constructor(encoding?:string, options?:{ fatal?:boolean;ignoreBOM?:boolean }) constructor(encoding?: string, options?: { fatal?: boolean;ignoreBOM?: boolean })
TextDecoder的构造函数。 TextDecoder的构造函数。
...@@ -168,13 +168,13 @@ TextDecoder的构造函数。 ...@@ -168,13 +168,13 @@ TextDecoder的构造函数。
**示例:** **示例:**
``` ```
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM:true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
``` ```
### decode ### decode
decode(input: Unit8Array, options?:{stream?:false}): string decode(input: Unit8Array, options?: {stream?: false}): string
通过输入参数解码后输出对应文本。 通过输入参数解码后输出对应文本。
...@@ -199,7 +199,7 @@ decode(input: Unit8Array, options?:{stream?:false}): string ...@@ -199,7 +199,7 @@ decode(input: Unit8Array, options?:{stream?:false}): string
**示例:** **示例:**
``` ```
var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM:true}); var textDecoder = new util.TextDecoder("utf-8",{ignoreBOM: true});
var result = new Uint8Array(6); var result = new Uint8Array(6);
result[0] = 0xEF; result[0] = 0xEF;
result[1] = 0xBB; result[1] = 0xBB;
...@@ -211,7 +211,7 @@ decode(input: Unit8Array, options?:{stream?:false}): string ...@@ -211,7 +211,7 @@ decode(input: Unit8Array, options?:{stream?:false}): string
for(var j= 0; j < 6; j++) { for(var j= 0; j < 6; j++) {
console.log(result[j]); console.log(result[j]);
} }
var retStr = textDecoder.decode( result , {stream:false}); var retStr = textDecoder.decode( result , {stream: false});
console.log("retStr = " + retStr); console.log("retStr = " + retStr);
``` ```
...@@ -243,7 +243,7 @@ TextEncoder的构造函数。 ...@@ -243,7 +243,7 @@ TextEncoder的构造函数。
### encode ### encode
encode(input?:string):Uint8Array encode(input?: string): Uint8Array
通过输入参数编码后输出对应文本。 通过输入参数编码后输出对应文本。
...@@ -269,7 +269,7 @@ encode(input?:string):Uint8Array ...@@ -269,7 +269,7 @@ encode(input?:string):Uint8Array
### encodeInto ### encodeInto
encodeInto(input:string, dest:Uint8Array, ):{ read:number; written:number } encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number }
放置生成的UTF-8编码文本。 放置生成的UTF-8编码文本。
...@@ -299,7 +299,7 @@ encodeInto(input:string, dest:Uint8Array, ):{ read:number; written:number } ...@@ -299,7 +299,7 @@ encodeInto(input:string, dest:Uint8Array, ):{ read:number; written:number }
### constructor<sup>8+</sup> ### constructor<sup>8+</sup>
constructor(numerator:number,denominator:number) constructor(numerator: number,denominator: number)
RationalNumber的构造函数。 RationalNumber的构造函数。
...@@ -319,7 +319,7 @@ RationalNumber的构造函数。 ...@@ -319,7 +319,7 @@ RationalNumber的构造函数。
### createRationalFromString<sup>8+</sup> ### createRationalFromString<sup>8+</sup>
static createRationalFromString​(rationalString:string):RationalNumber​ static createRationalFromString​(rationalString: string): RationalNumber​
基于给定的字符串创建一个RationalNumber对象。 基于给定的字符串创建一个RationalNumber对象。
...@@ -344,7 +344,7 @@ static createRationalFromString​(rationalString:string):RationalNumber​ ...@@ -344,7 +344,7 @@ static createRationalFromString​(rationalString:string):RationalNumber​
### compareTo<sup>8+</sup> ### compareTo<sup>8+</sup>
compareTo​(another:RationalNumber):number​ compareTo​(another: RationalNumber): number​
将当前的RationalNumber对象与给定的对象进行比较。 将当前的RationalNumber对象与给定的对象进行比较。
...@@ -370,7 +370,7 @@ compareTo​(another:RationalNumber):number​ ...@@ -370,7 +370,7 @@ compareTo​(another:RationalNumber):number​
### valueOf<sup>8+</sup> ### valueOf<sup>8+</sup>
valueOf():number valueOf(): number
以整数形式或者浮点数的形式获取当前RationalNumber对象的值。 以整数形式或者浮点数的形式获取当前RationalNumber对象的值。
...@@ -390,7 +390,7 @@ valueOf():number ...@@ -390,7 +390,7 @@ valueOf():number
### equals<sup>8+</sup> ### equals<sup>8+</sup>
equals​(obj:Object):boolean equals​(obj: Object): boolean
将当前的RationalNumber对象与给定的对象进行比较是否相等。 将当前的RationalNumber对象与给定的对象进行比较是否相等。
...@@ -416,7 +416,7 @@ equals​(obj:Object):boolean ...@@ -416,7 +416,7 @@ equals​(obj:Object):boolean
### getCommonDivisor<sup>8+</sup> ### getCommonDivisor<sup>8+</sup>
static getCommonDivisor​(number1:number,number2:number):number static getCommonDivisor​(number1: number,number2: number): number
获取两个指定整数的最大公约数。 获取两个指定整数的最大公约数。
...@@ -442,7 +442,7 @@ static getCommonDivisor​(number1:number,number2:number):number ...@@ -442,7 +442,7 @@ static getCommonDivisor​(number1:number,number2:number):number
### getNumerator<sup>8+</sup> ### getNumerator<sup>8+</sup>
getNumerator​():number getNumerator​(): number
获取当前RationalNumber对象的分子。 获取当前RationalNumber对象的分子。
...@@ -463,7 +463,7 @@ getNumerator​():number ...@@ -463,7 +463,7 @@ getNumerator​():number
### getDenominator<sup>8+</sup> ### getDenominator<sup>8+</sup>
getDenominator​():number getDenominator​(): number
获取当前RationalNumber对象的分母。 获取当前RationalNumber对象的分母。
...@@ -503,7 +503,7 @@ isZero​():boolean ...@@ -503,7 +503,7 @@ isZero​():boolean
### isNaN<sup>8+</sup> ### isNaN<sup>8+</sup>
isNaN​():boolean isNaN​(): boolean
检查当前RationalNumber对象是否表示非数字(NaN)值。 检查当前RationalNumber对象是否表示非数字(NaN)值。
...@@ -543,7 +543,7 @@ isFinite​():boolean ...@@ -543,7 +543,7 @@ isFinite​():boolean
### toString<sup>8+</sup> ### toString<sup>8+</sup>
toString​():string toString​(): string
获取当前RationalNumber对象的字符串表示形式。 获取当前RationalNumber对象的字符串表示形式。
...@@ -581,7 +581,7 @@ toString​():string ...@@ -581,7 +581,7 @@ toString​():string
### constructor<sup>8+</sup> ### constructor<sup>8+</sup>
constructor(capacity?:number) constructor(capacity?: number)
默认构造函数用于创建一个新的LruBuffer实例,默认容量为64。 默认构造函数用于创建一个新的LruBuffer实例,默认容量为64。
...@@ -600,7 +600,7 @@ constructor(capacity?:number) ...@@ -600,7 +600,7 @@ constructor(capacity?:number)
### updateCapacity<sup>8+</sup> ### updateCapacity<sup>8+</sup>
updateCapacity(newCapacity:number):void updateCapacity(newCapacity: number): void
将缓冲区容量更新为指定容量,如果newCapacity小于或等于0,则抛出异常。 将缓冲区容量更新为指定容量,如果newCapacity小于或等于0,则抛出异常。
...@@ -620,7 +620,7 @@ updateCapacity(newCapacity:number):void ...@@ -620,7 +620,7 @@ updateCapacity(newCapacity:number):void
### toString<sup>8+</sup> ### toString<sup>8+</sup>
toString():string toString(): string
返回对象的字符串表示形式。 返回对象的字符串表示形式。
...@@ -643,7 +643,7 @@ toString():string ...@@ -643,7 +643,7 @@ toString():string
### getCapacity<sup>8+</sup> ### getCapacity<sup>8+</sup>
getCapacity():number getCapacity(): number
获取当前缓冲区的容量。 获取当前缓冲区的容量。
...@@ -663,7 +663,7 @@ getCapacity():number ...@@ -663,7 +663,7 @@ getCapacity():number
### clear<sup>8+</sup> ### clear<sup>8+</sup>
clear():void clear(): void
从当前缓冲区清除键值对。后续会调用afterRemoval()方法执行后续操作。 从当前缓冲区清除键值对。后续会调用afterRemoval()方法执行后续操作。
...@@ -680,7 +680,7 @@ clear():void ...@@ -680,7 +680,7 @@ clear():void
### getCreateCount<sup>8+</sup> ### getCreateCount<sup>8+</sup>
getCreateCount():number getCreateCount(): number
获取createDefault()返回值的次数。 获取createDefault()返回值的次数。
...@@ -701,7 +701,7 @@ getCreateCount():number ...@@ -701,7 +701,7 @@ getCreateCount():number
### getMissCount<sup>8+</sup> ### getMissCount<sup>8+</sup>
getMissCount():number getMissCount(): number
获取查询值不匹配的次数。 获取查询值不匹配的次数。
...@@ -723,7 +723,7 @@ getMissCount():number ...@@ -723,7 +723,7 @@ getMissCount():number
### getRemovalCount<sup>8+</sup> ### getRemovalCount<sup>8+</sup>
getRemovalCount():number getRemovalCount(): number
获取从缓冲区中逐出值的次数。 获取从缓冲区中逐出值的次数。
...@@ -746,7 +746,7 @@ getRemovalCount():number ...@@ -746,7 +746,7 @@ getRemovalCount():number
### getMatchCount<sup>8+</sup> ### getMatchCount<sup>8+</sup>
getMatchCount():number getMatchCount(): number
获取查询值匹配成功的次数。 获取查询值匹配成功的次数。
...@@ -768,7 +768,7 @@ getMatchCount():number ...@@ -768,7 +768,7 @@ getMatchCount():number
### getPutCount<sup>8+</sup> ### getPutCount<sup>8+</sup>
getPutCount():number getPutCount(): number
获取将值添加到缓冲区的次数。 获取将值添加到缓冲区的次数。
...@@ -789,7 +789,7 @@ getPutCount():number ...@@ -789,7 +789,7 @@ getPutCount():number
### isEmpty<sup>8+</sup> ### isEmpty<sup>8+</sup>
isEmpty():boolean isEmpty(): boolean
检查当前缓冲区是否为空。 检查当前缓冲区是否为空。
...@@ -810,7 +810,7 @@ isEmpty():boolean ...@@ -810,7 +810,7 @@ isEmpty():boolean
### get<sup>8+</sup> ### get<sup>8+</sup>
get(key:K):V | undefined get(key: K): V | undefined
表示要查询的键。 表示要查询的键。
...@@ -836,7 +836,7 @@ get(key:K):V | undefined ...@@ -836,7 +836,7 @@ get(key:K):V | undefined
### put<sup>8+</sup> ### put<sup>8+</sup>
put(key:K,value:V):V put(key: K,value: V): V
将键值对添加到缓冲区。 将键值对添加到缓冲区。
...@@ -862,7 +862,7 @@ put(key:K,value:V):V ...@@ -862,7 +862,7 @@ put(key:K,value:V):V
### values<sup>8+</sup> ### values<sup>8+</sup>
values():V[] values(): V[]
获取当前缓冲区中所有值从最近访问到最近最少访问的顺序列表 。 获取当前缓冲区中所有值从最近访问到最近最少访问的顺序列表 。
...@@ -885,7 +885,7 @@ values():V[] ...@@ -885,7 +885,7 @@ values():V[]
### keys<sup>8+</sup> ### keys<sup>8+</sup>
keys():K[] keys(): K[]
获取当前缓冲区中所有键从最近访问到最近最少访问的升序列表。 获取当前缓冲区中所有键从最近访问到最近最少访问的升序列表。
...@@ -906,7 +906,7 @@ keys():K[] ...@@ -906,7 +906,7 @@ keys():K[]
### remove<sup>8+</sup> ### remove<sup>8+</sup>
remove(key:K):V | undefined remove(key: K): V | undefined
从当前缓冲区中删除指定的键及其关联的值。 从当前缓冲区中删除指定的键及其关联的值。
...@@ -932,7 +932,7 @@ remove(key:K):V | undefined ...@@ -932,7 +932,7 @@ remove(key:K):V | undefined
### afterRemoval<sup>8+</sup> ### afterRemoval<sup>8+</sup>
afterRemoval(isEvict:boolean,key:K,value:V,newValue:V):void afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void
删除值后执行后续操作。 删除值后执行后续操作。
...@@ -977,7 +977,7 @@ afterRemoval(isEvict:boolean,key:K,value:V,newValue:V):void ...@@ -977,7 +977,7 @@ afterRemoval(isEvict:boolean,key:K,value:V,newValue:V):void
### contains<sup>8+</sup> ### contains<sup>8+</sup>
contains(key:K):boolean contains(key: K): boolean
检查当前缓冲区是否包含指定的键。 检查当前缓冲区是否包含指定的键。
...@@ -1003,7 +1003,7 @@ contains(key:K):boolean ...@@ -1003,7 +1003,7 @@ contains(key:K):boolean
### createDefault<sup>8+</sup> ### createDefault<sup>8+</sup>
createDefault(key:K):V createDefault(key: K): V
如果未计算特定键的值,则执行后续操作,参数表示丢失的键,返回与键关联的值。 如果未计算特定键的值,则执行后续操作,参数表示丢失的键,返回与键关联的值。
...@@ -1028,7 +1028,7 @@ createDefault(key:K):V ...@@ -1028,7 +1028,7 @@ createDefault(key:K):V
### entries<sup>8+</sup> ### entries<sup>8+</sup>
entries():IterableIterator&lt;[K,V]&gt; entries(): IterableIterator&lt;[K,V]&gt;
允许迭代包含在这个对象中的所有键值对。 允许迭代包含在这个对象中的所有键值对。
...@@ -1078,7 +1078,7 @@ entries():IterableIterator&lt;[K,V]&gt; ...@@ -1078,7 +1078,7 @@ entries():IterableIterator&lt;[K,V]&gt;
ScopeComparable类型的值需要实现compareTo方法,确保传入的数据具有可比性。 ScopeComparable类型的值需要实现compareTo方法,确保传入的数据具有可比性。
``` ```
interface ScopeComparable{ interface ScopeComparable{
compareTo(other:ScopeComparable):boolean; compareTo(other: ScopeComparable): boolean;
} }
type ScopeType = ScopeComparable | number; type ScopeType = ScopeComparable | number;
``` ```
...@@ -1108,7 +1108,7 @@ class Temperature{ ...@@ -1108,7 +1108,7 @@ class Temperature{
### constructor<sup>8+</sup> ### constructor<sup>8+</sup>
constructor(lowerObj:ScopeType,upperObje:ScopeType) constructor(lowerObj: ScopeType,upperObje: ScopeType)
用于创建指定下限和上限的作用域实例的构造函数,返回一个Scope对象。 用于创建指定下限和上限的作用域实例的构造函数,返回一个Scope对象。
...@@ -1130,7 +1130,7 @@ constructor(lowerObj:ScopeType,upperObje:ScopeType) ...@@ -1130,7 +1130,7 @@ constructor(lowerObj:ScopeType,upperObje:ScopeType)
### toString<sup>8+</sup> ### toString<sup>8+</sup>
toString():string toString(): string
该字符串化方法返回一个包含当前范围的字符串表示形式。 该字符串化方法返回一个包含当前范围的字符串表示形式。
...@@ -1152,7 +1152,7 @@ toString():string ...@@ -1152,7 +1152,7 @@ toString():string
### intersect<sup>8+</sup> ### intersect<sup>8+</sup>
intersect(range:Scope):Scope intersect(range: Scope): Scope
获取给定范围和当前范围的交集。 获取给定范围和当前范围的交集。
...@@ -1212,7 +1212,7 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope ...@@ -1212,7 +1212,7 @@ intersect(lowerObj:ScopeType,upperObj:ScopeType):Scope
### getUpper<sup>8+</sup> ### getUpper<sup>8+</sup>
getUpper():ScopeType getUpper(): ScopeType
获取当前范围的上限。 获取当前范围的上限。
...@@ -1235,7 +1235,7 @@ getUpper():ScopeType ...@@ -1235,7 +1235,7 @@ getUpper():ScopeType
### getLower<sup>8+</sup> ### getLower<sup>8+</sup>
getLower():ScopeType getLower(): ScopeType
获取当前范围的下限。 获取当前范围的下限。
...@@ -1257,7 +1257,7 @@ getLower():ScopeType ...@@ -1257,7 +1257,7 @@ getLower():ScopeType
### expand<sup>8+</sup> ### expand<sup>8+</sup>
expand(lowerObj:ScopeType,upperObj:ScopeType):Scope expand(lowerObj: ScopeType,upperObj: ScopeType): Scope
创建并返回包括当前范围和给定下限和上限的并集。 创建并返回包括当前范围和给定下限和上限的并集。
...@@ -1287,7 +1287,7 @@ expand(lowerObj:ScopeType,upperObj:ScopeType):Scope ...@@ -1287,7 +1287,7 @@ expand(lowerObj:ScopeType,upperObj:ScopeType):Scope
### expand<sup>8+</sup> ### expand<sup>8+</sup>
expand(range:Scope):Scope expand(range: Scope): Scope
创建并返回包括当前范围和给定范围的并集。 创建并返回包括当前范围和给定范围的并集。
...@@ -1317,7 +1317,7 @@ expand(range:Scope):Scope ...@@ -1317,7 +1317,7 @@ expand(range:Scope):Scope
### expand<sup>8+</sup> ### expand<sup>8+</sup>
expand(value:ScopeType):Scope expand(value: ScopeType): Scope
创建并返回包括当前范围和给定值的并集。 创建并返回包括当前范围和给定值的并集。
...@@ -1345,7 +1345,7 @@ expand(value:ScopeType):Scope ...@@ -1345,7 +1345,7 @@ expand(value:ScopeType):Scope
### contains<sup>8+</sup> ### contains<sup>8+</sup>
contains(value:ScopeType):boolean contains(value: ScopeType): boolean
检查给定value是否包含在当前范围内。 检查给定value是否包含在当前范围内。
...@@ -1373,7 +1373,7 @@ contains(value:ScopeType):boolean ...@@ -1373,7 +1373,7 @@ contains(value:ScopeType):boolean
### contains<sup>8+</sup> ### contains<sup>8+</sup>
contains(range:Scope):boolean contains(range: Scope): boolean
检查给定range是否在当前范围内。 检查给定range是否在当前范围内。
...@@ -1403,7 +1403,7 @@ contains(range:Scope):boolean ...@@ -1403,7 +1403,7 @@ contains(range:Scope):boolean
### clamp<sup>8+</sup> ### clamp<sup>8+</sup>
clamp(value:ScopeType):ScopeType clamp(value: ScopeType): ScopeType
将给定值限定到当前范围内。 将给定值限定到当前范围内。
...@@ -1448,7 +1448,7 @@ Base64的构造函数。 ...@@ -1448,7 +1448,7 @@ Base64的构造函数。
### encodeSync<sup>8+</sup> ### encodeSync<sup>8+</sup>
encodeSync(src:Uint8Array):Uint8Array encodeSync(src: Uint8Array): Uint8Array
通过输入参数编码后输出对应文本。 通过输入参数编码后输出对应文本。
...@@ -1474,7 +1474,7 @@ encodeSync(src:Uint8Array):Uint8Array ...@@ -1474,7 +1474,7 @@ encodeSync(src:Uint8Array):Uint8Array
### encodeToStringSync<sup>8+</sup> ### encodeToStringSync<sup>8+</sup>
encodeToStringSync(src:Uint8Array):string encodeToStringSync(src: Uint8Array): string
通过输入参数编码后输出对应文本。 通过输入参数编码后输出对应文本。
...@@ -1500,7 +1500,7 @@ encodeToStringSync(src:Uint8Array):string ...@@ -1500,7 +1500,7 @@ encodeToStringSync(src:Uint8Array):string
### decodeSync<sup>8+</sup> ### decodeSync<sup>8+</sup>
decodeSync(src:Uint8Array | string):Uint8Array decodeSync(src: Uint8Array | string): Uint8Array
通过输入参数解码后输出对应文本。 通过输入参数解码后输出对应文本。
...@@ -1526,7 +1526,7 @@ decodeSync(src:Uint8Array | string):Uint8Array ...@@ -1526,7 +1526,7 @@ decodeSync(src:Uint8Array | string):Uint8Array
### encode<sup>8+</sup> ### encode<sup>8+</sup>
encode(src:Uint8Array):Promise&lt;Uint8Array&gt; encode(src: Uint8Array): Promise&lt;Uint8Array&gt;
通过输入参数异步编码后输出对应文本。 通过输入参数异步编码后输出对应文本。
...@@ -1557,7 +1557,7 @@ encode(src:Uint8Array):Promise&lt;Uint8Array&gt; ...@@ -1557,7 +1557,7 @@ encode(src:Uint8Array):Promise&lt;Uint8Array&gt;
### encodeToString<sup>8+</sup> ### encodeToString<sup>8+</sup>
encodeToString(src:Uint8Array):Promise&lt;string&gt; encodeToString(src: Uint8Array): Promise&lt;string&gt;
通过输入参数异步编码后输出对应文本。 通过输入参数异步编码后输出对应文本。
...@@ -1585,7 +1585,7 @@ encodeToString(src:Uint8Array):Promise&lt;string&gt; ...@@ -1585,7 +1585,7 @@ encodeToString(src:Uint8Array):Promise&lt;string&gt;
### decode<sup>8+</sup> ### decode<sup>8+</sup>
decode(src:Uint8Array | string):Promise&lt;Uint8Array&gt; decode(src: Uint8Array | string): Promise&lt;Uint8Array&gt;
通过输入参数异步解码后输出对应文本。 通过输入参数异步解码后输出对应文本。
...@@ -1633,7 +1633,7 @@ Types的构造函数。 ...@@ -1633,7 +1633,7 @@ Types的构造函数。
### isAnyArrayBuffer<sup>8+</sup> ### isAnyArrayBuffer<sup>8+</sup>
isAnyArrayBuffer(value: Object):boolean isAnyArrayBuffer(value: Object): boolean
检查输入的value是否是ArrayBuffer类型。 检查输入的value是否是ArrayBuffer类型。
...@@ -1658,7 +1658,7 @@ isAnyArrayBuffer(value: Object):boolean ...@@ -1658,7 +1658,7 @@ isAnyArrayBuffer(value: Object):boolean
### isArrayBufferView<sup>8+</sup> ### isArrayBufferView<sup>8+</sup>
isArrayBufferView(value: Object):boolean isArrayBufferView(value: Object): boolean
检查输入的value是否是内置ArrayBufferView辅助类型。 检查输入的value是否是内置ArrayBufferView辅助类型。
...@@ -1685,7 +1685,7 @@ ArrayBufferView辅助类型包括:Int8Array、Int16Array、Int32Array、Uint8A ...@@ -1685,7 +1685,7 @@ ArrayBufferView辅助类型包括:Int8Array、Int16Array、Int32Array、Uint8A
### isArgumentsObject<sup>8+</sup> ### isArgumentsObject<sup>8+</sup>
isArgumentsObject(value: Object):boolean isArgumentsObject(value: Object): boolean
检查输入的value是否是一个arguments对象类型。 检查输入的value是否是一个arguments对象类型。
...@@ -1713,7 +1713,7 @@ isArgumentsObject(value: Object):boolean ...@@ -1713,7 +1713,7 @@ isArgumentsObject(value: Object):boolean
### isArrayBuffer<sup>8+</sup> ### isArrayBuffer<sup>8+</sup>
isArrayBuffer(value: Object):boolean isArrayBuffer(value: Object): boolean
检查输入的value是否是ArrayBuffer类型。 检查输入的value是否是ArrayBuffer类型。
...@@ -1738,7 +1738,7 @@ isArrayBuffer(value: Object):boolean ...@@ -1738,7 +1738,7 @@ isArrayBuffer(value: Object):boolean
### isAsyncFunction<sup>8+</sup> ### isAsyncFunction<sup>8+</sup>
isAsyncFunction(value: Object):boolean isAsyncFunction(value: Object): boolean
检查输入的value是否是一个异步函数类型。 检查输入的value是否是一个异步函数类型。
...@@ -1763,7 +1763,7 @@ isAsyncFunction(value: Object):boolean ...@@ -1763,7 +1763,7 @@ isAsyncFunction(value: Object):boolean
### isBooleanObject<sup>8+</sup> ### isBooleanObject<sup>8+</sup>
isBooleanObject(value: Object):boolean isBooleanObject(value: Object): boolean
检查输入的value是否是一个Boolean对象类型。 检查输入的value是否是一个Boolean对象类型。
...@@ -1788,7 +1788,7 @@ isBooleanObject(value: Object):boolean ...@@ -1788,7 +1788,7 @@ isBooleanObject(value: Object):boolean
### isBoxedPrimitive<sup>8+</sup> ### isBoxedPrimitive<sup>8+</sup>
isBoxedPrimitive(value: Object):boolean isBoxedPrimitive(value: Object): boolean
检查输入的value是否是Boolean或Number或String或Symbol对象类型。 检查输入的value是否是Boolean或Number或String或Symbol对象类型。
...@@ -1813,7 +1813,7 @@ isBoxedPrimitive(value: Object):boolean ...@@ -1813,7 +1813,7 @@ isBoxedPrimitive(value: Object):boolean
### isDataView<sup>8+</sup> ### isDataView<sup>8+</sup>
isDataView(value: Object):boolean isDataView(value: Object): boolean
检查输入的value是否是DataView类型。 检查输入的value是否是DataView类型。
...@@ -1839,7 +1839,7 @@ isDataView(value: Object):boolean ...@@ -1839,7 +1839,7 @@ isDataView(value: Object):boolean
### isDate<sup>8+</sup> ### isDate<sup>8+</sup>
isDate(value: Object):boolean isDate(value: Object): boolean
检查输入的value是否是Date类型。 检查输入的value是否是Date类型。
...@@ -1864,7 +1864,7 @@ isDate(value: Object):boolean ...@@ -1864,7 +1864,7 @@ isDate(value: Object):boolean
### isExternal<sup>8+</sup> ### isExternal<sup>8+</sup>
isExternal(value: Object):boolean isExternal(value: Object): boolean
检查输入的value是否是native External类型。 检查输入的value是否是native External类型。
...@@ -1890,7 +1890,7 @@ isExternal(value: Object):boolean ...@@ -1890,7 +1890,7 @@ isExternal(value: Object):boolean
### isFloat32Array<sup>8+</sup> ### isFloat32Array<sup>8+</sup>
isFloat32Array(value: Object):boolean isFloat32Array(value: Object): boolean
检查输入的value是否是Float32Array数组类型。 检查输入的value是否是Float32Array数组类型。
...@@ -1915,7 +1915,7 @@ isFloat32Array(value: Object):boolean ...@@ -1915,7 +1915,7 @@ isFloat32Array(value: Object):boolean
### isFloat64Array<sup>8+</sup> ### isFloat64Array<sup>8+</sup>
isFloat64Array(value: Object):boolean isFloat64Array(value: Object): boolean
检查输入的value是否是Float64Array数组类型。 检查输入的value是否是Float64Array数组类型。
...@@ -1940,7 +1940,7 @@ isFloat64Array(value: Object):boolean ...@@ -1940,7 +1940,7 @@ isFloat64Array(value: Object):boolean
### isGeneratorFunction<sup>8+</sup> ### isGeneratorFunction<sup>8+</sup>
isGeneratorFunction(value: Object):boolean isGeneratorFunction(value: Object): boolean
检查输入的value是否是generator函数类型。 检查输入的value是否是generator函数类型。
...@@ -1965,7 +1965,7 @@ isGeneratorFunction(value: Object):boolean ...@@ -1965,7 +1965,7 @@ isGeneratorFunction(value: Object):boolean
### isGeneratorObject<sup>8+</sup> ### isGeneratorObject<sup>8+</sup>
isGeneratorObject(value: Object):boolean isGeneratorObject(value: Object): boolean
检查输入的value是否是generator对象类型。 检查输入的value是否是generator对象类型。
...@@ -1992,7 +1992,7 @@ isGeneratorObject(value: Object):boolean ...@@ -1992,7 +1992,7 @@ isGeneratorObject(value: Object):boolean
### isInt8Array<sup>8+</sup> ### isInt8Array<sup>8+</sup>
isInt8Array(value: Object):boolean isInt8Array(value: Object): boolean
检查输入的value是否是Int8Array数组类型。 检查输入的value是否是Int8Array数组类型。
...@@ -2017,7 +2017,7 @@ isInt8Array(value: Object):boolean ...@@ -2017,7 +2017,7 @@ isInt8Array(value: Object):boolean
### isInt16Array<sup>8+</sup> ### isInt16Array<sup>8+</sup>
isInt16Array(value: Object):boolean isInt16Array(value: Object): boolean
检查输入的value是否是Int16Array数组类型。 检查输入的value是否是Int16Array数组类型。
...@@ -2042,7 +2042,7 @@ isInt16Array(value: Object):boolean ...@@ -2042,7 +2042,7 @@ isInt16Array(value: Object):boolean
### isInt32Array<sup>8+</sup> ### isInt32Array<sup>8+</sup>
isInt32Array(value: Object):boolean isInt32Array(value: Object): boolean
检查输入的value是否是Int32Array数组类型。 检查输入的value是否是Int32Array数组类型。
...@@ -2067,7 +2067,7 @@ isInt32Array(value: Object):boolean ...@@ -2067,7 +2067,7 @@ isInt32Array(value: Object):boolean
### isMap<sup>8+</sup> ### isMap<sup>8+</sup>
isMap(value: Object):boolean isMap(value: Object): boolean
检查输入的value是否是Map类型。 检查输入的value是否是Map类型。
...@@ -2092,7 +2092,7 @@ isMap(value: Object):boolean ...@@ -2092,7 +2092,7 @@ isMap(value: Object):boolean
### isMapIterator<sup>8+</sup> ### isMapIterator<sup>8+</sup>
isMapIterator(value: Object):boolean isMapIterator(value: Object): boolean
检查输入的value是否是Map的Iterator类型。 检查输入的value是否是Map的Iterator类型。
...@@ -2118,7 +2118,7 @@ isMapIterator(value: Object):boolean ...@@ -2118,7 +2118,7 @@ isMapIterator(value: Object):boolean
### isNativeError<sup>8+</sup> ### isNativeError<sup>8+</sup>
isNativeError(value: Object):boolean isNativeError(value: Object): boolean
检查输入的value是否是Error类型。 检查输入的value是否是Error类型。
...@@ -2143,7 +2143,7 @@ isNativeError(value: Object):boolean ...@@ -2143,7 +2143,7 @@ isNativeError(value: Object):boolean
### isNumberObject<sup>8+</sup> ### isNumberObject<sup>8+</sup>
isNumberObject(value: Object):boolean isNumberObject(value: Object): boolean
检查输入的value是否是Number对象类型。 检查输入的value是否是Number对象类型。
...@@ -2168,7 +2168,7 @@ isNumberObject(value: Object):boolean ...@@ -2168,7 +2168,7 @@ isNumberObject(value: Object):boolean
### isPromise<sup>8+</sup> ### isPromise<sup>8+</sup>
isPromise(value: Object):boolean isPromise(value: Object): boolean
检查输入的value是否是Promise类型。 检查输入的value是否是Promise类型。
...@@ -2193,7 +2193,7 @@ isPromise(value: Object):boolean ...@@ -2193,7 +2193,7 @@ isPromise(value: Object):boolean
### isProxy<sup>8+</sup> ### isProxy<sup>8+</sup>
isProxy(value: Object):boolean isProxy(value: Object): boolean
检查输入的value是否是Proxy类型。 检查输入的value是否是Proxy类型。
...@@ -2220,7 +2220,7 @@ isProxy(value: Object):boolean ...@@ -2220,7 +2220,7 @@ isProxy(value: Object):boolean
### isRegExp<sup>8+</sup> ### isRegExp<sup>8+</sup>
isRegExp(value: Object):boolean isRegExp(value: Object): boolean
检查输入的value是否是RegExp类型。 检查输入的value是否是RegExp类型。
...@@ -2245,7 +2245,7 @@ isRegExp(value: Object):boolean ...@@ -2245,7 +2245,7 @@ isRegExp(value: Object):boolean
### isSet<sup>8+</sup> ### isSet<sup>8+</sup>
isSet(value: Object):boolean isSet(value: Object): boolean
检查输入的value是否是Set类型。 检查输入的value是否是Set类型。
...@@ -2270,7 +2270,7 @@ isSet(value: Object):boolean ...@@ -2270,7 +2270,7 @@ isSet(value: Object):boolean
### isSetIterator<sup>8+</sup> ### isSetIterator<sup>8+</sup>
isSetIterator(value: Object):boolean isSetIterator(value: Object): boolean
检查输入的value是否是Set的Iterator类型。 检查输入的value是否是Set的Iterator类型。
...@@ -2296,7 +2296,7 @@ isSetIterator(value: Object):boolean ...@@ -2296,7 +2296,7 @@ isSetIterator(value: Object):boolean
### isStringObject<sup>8+</sup> ### isStringObject<sup>8+</sup>
isStringObject(value: Object):boolean isStringObject(value: Object): boolean
检查输入的value是否是String对象类型。 检查输入的value是否是String对象类型。
...@@ -2347,7 +2347,7 @@ isSymbolObjec(value: Object): boolean ...@@ -2347,7 +2347,7 @@ isSymbolObjec(value: Object): boolean
### isTypedArray<sup>8+</sup> ### isTypedArray<sup>8+</sup>
isTypedArray(value: Object):boolean isTypedArray(value: Object): boolean
检查输入的value是否是TypedArray类型的辅助类型。 检查输入的value是否是TypedArray类型的辅助类型。
...@@ -2374,7 +2374,7 @@ TypedArray类型的辅助类型,包括Int8Array、Int16Array、Int32Array、Ui ...@@ -2374,7 +2374,7 @@ TypedArray类型的辅助类型,包括Int8Array、Int16Array、Int32Array、Ui
### isUint8Array<sup>8+</sup> ### isUint8Array<sup>8+</sup>
isUint8Array(value: Object):boolean isUint8Array(value: Object): boolean
检查输入的value是否是Uint8Array数组类型。 检查输入的value是否是Uint8Array数组类型。
...@@ -2399,7 +2399,7 @@ isUint8Array(value: Object):boolean ...@@ -2399,7 +2399,7 @@ isUint8Array(value: Object):boolean
### isUint8ClampedArray<sup>8+</sup> ### isUint8ClampedArray<sup>8+</sup>
isUint8ClampedArray(value: Object):boolean isUint8ClampedArray(value: Object): boolean
检查输入的value是否是Uint8ClampedArray数组类型。 检查输入的value是否是Uint8ClampedArray数组类型。
...@@ -2424,7 +2424,7 @@ isUint8ClampedArray(value: Object):boolean ...@@ -2424,7 +2424,7 @@ isUint8ClampedArray(value: Object):boolean
### isUint16Array<sup>8+</sup> ### isUint16Array<sup>8+</sup>
isUint16Array(value: Object):boolean isUint16Array(value: Object): boolean
检查输入的value是否是Uint16Array数组类型。 检查输入的value是否是Uint16Array数组类型。
...@@ -2449,7 +2449,7 @@ isUint16Array(value: Object):boolean ...@@ -2449,7 +2449,7 @@ isUint16Array(value: Object):boolean
### isUint32Array<sup>8+</sup> ### isUint32Array<sup>8+</sup>
isUint32Array(value: Object):boolean isUint32Array(value: Object): boolean
检查输入的value是否是Uint32Array数组类型。 检查输入的value是否是Uint32Array数组类型。
...@@ -2474,7 +2474,7 @@ isUint32Array(value: Object):boolean ...@@ -2474,7 +2474,7 @@ isUint32Array(value: Object):boolean
### isWeakMap<sup>8+</sup> ### isWeakMap<sup>8+</sup>
isWeakMap(value: Object):boolean isWeakMap(value: Object): boolean
检查输入的value是否是WeakMap类型。 检查输入的value是否是WeakMap类型。
...@@ -2499,7 +2499,7 @@ isWeakMap(value: Object):boolean ...@@ -2499,7 +2499,7 @@ isWeakMap(value: Object):boolean
### isWeakSet<sup>8+</sup> ### isWeakSet<sup>8+</sup>
isWeakSet(value: Object):boolean isWeakSet(value: Object): boolean
检查输入的value是否是WeakSet类型。 检查输入的value是否是WeakSet类型。
......
...@@ -358,7 +358,7 @@ reset(wallpaperType: WallpaperType, callback: AsyncCallback&lt;void&gt;): void ...@@ -358,7 +358,7 @@ reset(wallpaperType: WallpaperType, callback: AsyncCallback&lt;void&gt;): void
- 示例: - 示例:
``` ```
wallpaper.reset((error, data) => { wallpaper.reset(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
if (error) { if (error) {
console.error(`failed to reset because: ` + JSON.stringify(error)); console.error(`failed to reset because: ` + JSON.stringify(error));
return; return;
...@@ -391,7 +391,7 @@ reset(wallpaperType: WallpaperType): Promise&lt;void&gt; ...@@ -391,7 +391,7 @@ reset(wallpaperType: WallpaperType): Promise&lt;void&gt;
- 示例: - 示例:
``` ```
wallpaper.reset(wallpaper.WALLPAPER_SYSTEM).then((data) => { wallpaper.reset(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`success to reset.`); console.log(`success to reset.`);
}).catch((error) => { }).catch((error) => {
console.error(`failed to reset because: ` + JSON.stringify(error)); console.error(`failed to reset because: ` + JSON.stringify(error));
...@@ -401,7 +401,7 @@ reset(wallpaperType: WallpaperType): Promise&lt;void&gt; ...@@ -401,7 +401,7 @@ reset(wallpaperType: WallpaperType): Promise&lt;void&gt;
## wallpaper.setWallpaper ## wallpaper.setWallpaper
setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback&lt;void&gt;): void setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback&lt;void&gt;): void
将指定资源设置为指定类型的壁纸。 将指定资源设置为指定类型的壁纸。
...@@ -412,16 +412,16 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp ...@@ -412,16 +412,16 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| uriOrPixelMap | string&nbsp;\|[PixelMap](js-apis-image.md#pixelmap7) | | JPEG或PNG文件的Uri路径,或者PNG格式文件的位图。 | | source | string&nbsp;\|[PixelMap](js-apis-image.md#pixelmap7) | | JPEG或PNG文件的Uri路径,或者PNG格式文件的位图。 |
| wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 | | wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 |
| callback | AsyncCallback&lt;void&gt; | 是 | 回调函数,调用成功则返回是返回设置的结果,调用失败则返回error信息。 | | callback | AsyncCallback&lt;void&gt; | 是 | 回调函数,调用成功则返回是返回设置的结果,调用失败则返回error信息。 |
- 示例: - 示例:
``` ```
// uriOrPixelMap类型为string // source类型为string
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setWallpaper(wallpaperPath, wallpaper.WALLPAPER_SYSTEM, (error, data) => { wallpaper.setWallpaper(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
if (error) { if (error) {
console.error(`failed to setWallpaper because: ` + JSON.stringify(error)); console.error(`failed to setWallpaper because: ` + JSON.stringify(error));
return; return;
...@@ -429,7 +429,7 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp ...@@ -429,7 +429,7 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp
console.log(`success to setWallpaper.`); console.log(`success to setWallpaper.`);
}); });
// uriOrPixelMap类型为image.PixelMap // source类型为image.PixelMap
import image from '@ohos.multimedia.image'; import image from '@ohos.multimedia.image';
let imageSource = image.createImageSource("file://" + wallpaperPath); let imageSource = image.createImageSource("file://" + wallpaperPath);
let opts = { let opts = {
...@@ -439,7 +439,7 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp ...@@ -439,7 +439,7 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp
} }
}; };
imageSource.createPixelMap(opts).then((pixelMap) => { imageSource.createPixelMap(opts).then((pixelMap) => {
wallpaper.setWallpaper(pixelMap, wallpaper.WALLPAPER_SYSTEM, (error, data) => { wallpaper.setWallpaper(pixelMap, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
if (error) { if (error) {
console.error(`failed to setWallpaper because: ` + JSON.stringify(error)); console.error(`failed to setWallpaper because: ` + JSON.stringify(error));
return; return;
...@@ -454,7 +454,7 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp ...@@ -454,7 +454,7 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp
## wallpaper.setWallpaper ## wallpaper.setWallpaper
setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperType): Promise&lt;void&gt; setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise&lt;void&gt;
将指定资源设置为指定类型的壁纸。 将指定资源设置为指定类型的壁纸。
...@@ -465,7 +465,7 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp ...@@ -465,7 +465,7 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp
- 参数: - 参数:
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| uriOrPixelMap | string&nbsp;\|[PixelMap](js-apis-image.md#pixelmap7) | 是 | JPEG或PNG文件的Uri路径,或者PNG格式文件的位图。 | | source | string&nbsp;\|[PixelMap](js-apis-image.md#pixelmap7) | 是 | JPEG或PNG文件的Uri路径,或者PNG格式文件的位图。 |
| wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 | | wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 |
- 返回值: - 返回值:
...@@ -476,15 +476,15 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp ...@@ -476,15 +476,15 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp
- 示例: - 示例:
``` ```
// uriOrPixelMap类型为string // source类型为string
let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg";
wallpaper.setWallpaper(wallpaperPath, wallpaper.WALLPAPER_SYSTEM).then((data) => { wallpaper.setWallpaper(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`success to setWallpaper.`); console.log(`success to setWallpaper.`);
}).catch((error) => { }).catch((error) => {
console.error(`failed to setWallpaper because: ` + JSON.stringify(error)); console.error(`failed to setWallpaper because: ` + JSON.stringify(error));
}); });
// uriOrPixelMap类型为image.PixelMap // source类型为image.PixelMap
import image from '@ohos.multimedia.image'; import image from '@ohos.multimedia.image';
let imageSource = image.createImageSource("file://" + wallpaperPath); let imageSource = image.createImageSource("file://" + wallpaperPath);
let opts = { let opts = {
...@@ -494,7 +494,7 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp ...@@ -494,7 +494,7 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp
} }
}; };
imageSource.createPixelMap(opts).then((pixelMap) => { imageSource.createPixelMap(opts).then((pixelMap) => {
wallpaper.setWallpaper(pixelMap, wallpaper.WALLPAPER_SYSTEM).then((data) => { wallpaper.setWallpaper(pixelMap, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`success to setWallpaper.`); console.log(`success to setWallpaper.`);
}).catch((error) => { }).catch((error) => {
console.error(`failed to setWallpaper because: ` + JSON.stringify(error)); console.error(`failed to setWallpaper because: ` + JSON.stringify(error));
...@@ -503,6 +503,62 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp ...@@ -503,6 +503,62 @@ setWallpaper(uriOrPixelMap: string | image.PixelMap, wallpaperType: WallpaperTyp
console.error(`failed to createPixelMap because: ` + JSON.stringify(error)); console.error(`failed to createPixelMap because: ` + JSON.stringify(error));
}); });
``` ```
## wallpaper.getFile<sup>8+</sup>
getFile(wallpaperType: WallpaperType, callback: AsyncCallback&lt;number&gt;): void
获取指定类型的壁纸文件。
**需要权限**:ohos.permission.SET_WALLPAPER、ohos.permission.READ_USER_STORAGE
**系统能力**: SystemCapability.Miscservices.Wallpaper
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 |
| callback | AsyncCallback&lt;number&gt; | 是 | 回调函数,调用成功则返回壁纸文件描述符ID,调用失败则返回error信息。 |
- 示例:
```
wallpaper.getFile(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error, data) => {
if (error) {
console.error(`failed to getFile because: ` + JSON.stringify(error));
return;
}
console.log(`success to getFile: ` + JSON.stringify(data));
});
```
## wallpaper.getFile<sup>8+</sup>
getFile(wallpaperType: WallpaperType): Promise&lt;number&gt;
获取指定类型的壁纸文件。
**需要权限:** ohos.permission.SET_WALLPAPER、ohos.permission.READ_USER_STORAGE
**系统能力**: SystemCapability.Miscservices.Wallpaper
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 |
- 返回值:
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;number&gt; | 调用成功则返回壁纸文件描述符ID,调用失败则返回error信息。 |
- 示例:
```
wallpaper.getFile(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => {
console.log(`success to getFile: ` + JSON.stringify(data));
}).catch((error) => {
console.error(`failed to getFile because: ` + JSON.stringify(error));
});
```
## wallpaper.on('colorChange') ## wallpaper.on('colorChange')
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
- [QRCode](ts-basic-components-qrcode.md) - [QRCode](ts-basic-components-qrcode.md)
- [Radio](ts-basic-components-radio.md) - [Radio](ts-basic-components-radio.md)
- [Rating](ts-basic-components-rating.md) - [Rating](ts-basic-components-rating.md)
- [Search](ts-basic-components-search.md)
- [Select](ts-basic-components-select.md) - [Select](ts-basic-components-select.md)
- [Slider](ts-basic-components-slider.md) - [Slider](ts-basic-components-slider.md)
- [Span](ts-basic-components-span.md) - [Span](ts-basic-components-span.md)
......
...@@ -28,11 +28,11 @@ Navigation() ...@@ -28,11 +28,11 @@ Navigation()
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| title | string&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md#custombuilder类型8+)<sup>8+</sup> | - | 页面标题。 | | title | string&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md#CustomBuilder类型)<sup>8+</sup> | - | 页面标题。 |
| subtitle | string | - | 页面副标题。 | | subtitle | string | - | 页面副标题。 |
| menus | Array<NavigationMenuItem&gt;&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md#custombuilder类型8+)<sup>8+</sup> | - | 页面右上角菜单。 | | menus | Array<NavigationMenuItem&gt;&nbsp;\|&nbsp;[CustomBuilder](../../ui/ts-types.md#CustomBuilder类型)<sup>8+</sup> | - | 页面右上角菜单。 |
| titleMode | NavigationTitleMode | NavigationTitleMode.Free | 页面标题栏显示模式。 | | titleMode | NavigationTitleMode | NavigationTitleMode.Free | 页面标题栏显示模式。 |
| toolBar | {<br/>items:[<br/>Object<br/>]&nbsp;}<br/>\|&nbsp;[CustomBuilder](../../ui/ts-types.md#custombuilder类型8+)<sup>8+</sup> | - | 设置工具栏内容。<br/>items:&nbsp;工具栏所有项。 | | toolBar | {<br/>items:[<br/>Object<br/>]&nbsp;}<br/>\|&nbsp;[CustomBuilder](../../ui/ts-types.md#CustomBuilder类型)<sup>8+</sup> | - | 设置工具栏内容。<br/>items:&nbsp;工具栏所有项。 |
| hideToolBar | boolean | false | 设置隐藏/显示工具栏:<br/>true:&nbsp;隐藏工具栏。<br/>false:&nbsp;显示工具栏。 | | hideToolBar | boolean | false | 设置隐藏/显示工具栏:<br/>true:&nbsp;隐藏工具栏。<br/>false:&nbsp;显示工具栏。 |
| hideTitleBar | boolean | false | 隐藏标题栏。 | | hideTitleBar | boolean | false | 隐藏标题栏。 |
| hideBackButton | boolean | false | 隐藏返回键。 | | hideBackButton | boolean | false | 隐藏返回键。 |
...@@ -64,9 +64,9 @@ Navigation() ...@@ -64,9 +64,9 @@ Navigation()
## 事件 ## 事件
| 名称 | 功能描述 | | 名称 | 功能描述 |
| -------- | -------- | | -------- | -------- |
| onTitleModeChanged(callback:&nbsp;(titleMode:&nbsp;NavigationTitleMode)&nbsp;=&gt;&nbsp;void) | 当titleMode为NavigationTitleMode.Free时,随着可滚动组件的滑动标题栏模式发生变化时触发此回调。 | | onTitleModeChange(callback:&nbsp;(titleMode:&nbsp;NavigationTitleMode)&nbsp;=&gt;&nbsp;void) | 当titleMode为NavigationTitleMode.Free时,随着可滚动组件的滑动标题栏模式发生变化时触发此回调。 |
## 示例 ## 示例
...@@ -138,7 +138,7 @@ struct NavigationExample { ...@@ -138,7 +138,7 @@ struct NavigationExample {
.titleMode(NavigationTitleMode.Free) .titleMode(NavigationTitleMode.Free)
.hideTitleBar(false) .hideTitleBar(false)
.hideBackButton(false) .hideBackButton(false)
.onTitleModeChanged((titleModel: NavigationTitleMode) => { .onTitleModeChange((titleModel: NavigationTitleMode) => {
console.log('titleMode') console.log('titleMode')
}) })
.toolBar({ items: [ .toolBar({ items: [
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
## 接口 ## 接口
ScrollBar(value: ScrollBarOption) ScrollBar(value: ScrollBarOptions)
- ScrollBarOption的参数描述 - ScrollBarOptions的参数描述
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| scroller | [Scroller](ts-container-scroll.md#scroller) | 是 | - | 可滚动组件的控制器。用于与可滚动组件进行绑定。 | | scroller | [Scroller](ts-container-scroll.md#scroller) | 是 | - | 可滚动组件的控制器。用于与可滚动组件进行绑定。 |
......
# Search
> ![](public_sys-resources/icon-note.gif) **说明:** 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
提供搜索框组件,用于提供用户搜索内容的输入区域。
## 权限列表
## 子组件
## 接口
Search(options?: { value?: string; placeholder?: string; icon?: string; controller?: SearchController })
- 参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- |
| value | string | 否 | - | 搜索文本值。 |
| placeholder | string | 否 | - | 无输入时的提示文本。|
| icon | string | 否 | - | 搜索图标路径,默认使用系统搜索图标,支持的图标格式: svg, jpg和png。 |
| controller | SearchController | 否 | - | 控制器。|
## 属性
| 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- |
| searchButton | string | 无 | 搜索框末尾搜索按钮文本值,默认无搜索按钮。|
| placeholderColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置placeholder颜色。|
| placeholderFont | [Font](../../ui/ts-types.md#Font) | - | 设置placeholder文本样式。|
| textFont | [Font](../../ui/ts-types.md#Font) | - | 设置搜索框内文本样式。|
## 事件
| 名称 | 功能描述 |
| -------- | -------- |
| onSubmit(callback: (value: string) => void) | 点击搜索图标、搜索按钮或者按下软键盘搜索按钮时触发。<br> -value: 当前输入文本框的内容。|
| onChange(callback: (value: string) => void) | 输入内容发生变化时,触发回调。<br> -value: 当前输入文本框的内容。|
| onCopy(callback: (value: string) => void) | 组件触发系统剪切板复制操作。<br> -value: 复制的文本内容。|
| onCut(callback: (value: string) => void) | 组件触发系统剪切板剪切操作。<br> -value: 剪切的文本内容。|
| onPaste(callback: (value: string) => void) | 组件触发系统剪切板粘贴操作。<br> -value: 粘贴的文本内容。|
## SearchController
Search组件的控制器,通过它操作Search组件。
#### 导入对象
```
controller: SearchController = new SearchController()
```
#### caretPosition
creatPosition(value: number): viod
设置输入光标的位置。
- 参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| ---- | ------ | ---- | ---- | --------------------- |
| value | number | 是 | - | 从字符串开始到光标所在位置的长度。 |
## 示例
```
@Entry
@Component
struct SearchExample {
@State changevalue: string = ''
@State submitvalue: string = ''
controller: SearchController = new SearchController()
build() {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Text(this.submitvalue)
Text(this.changevalue)
Search({value: '', placeholder: 'Type to search', controller: this.controller})
.searchButton('Search')
.width(400)
.height(35)
.backgroundColor(Color.White)
.placeholderColor(Color.Grey)
.placeholderFont({ size: 50, weight: 10, family: 'serif', style: FontStyle.Normal })
.onSubmit((value: string) => {
this.submitvalue = value
})
.onChange((value: string) => {
this.changevalue = value
})
.margin({ top: 30 })
}
}
}
```
...@@ -29,20 +29,20 @@ Select(options: Array<SelectOption>) ...@@ -29,20 +29,20 @@ Select(options: Array<SelectOption>)
| ----------------------- | --------------------------------------------------- | ------ | ----------------------------------------------- | | ----------------------- | --------------------------------------------------- | ------ | ----------------------------------------------- |
| selected | number | - | 设置下拉菜单初始选择项的索引,第一项的索引为0。 | | selected | number | - | 设置下拉菜单初始选择项的索引,第一项的索引为0。 |
| value | string | - | 设置下拉按钮本身的文本显示。 | | value | string | - | 设置下拉按钮本身的文本显示。 |
| font | [Font](../../ui/ts-types.md#Font) | - | 设置下拉按钮本身的文本样式: | | font | [Font](../../ui/ts-types.md#Font类型) | - | 设置下拉按钮本身的文本样式: |
| fontColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置下拉按钮本身的文本颜色。 | | fontColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置下拉按钮本身的文本颜色。 |
| selectedOptionBgColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置下拉菜单选中项的背景色。 | | selectedOptionBgColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置下拉菜单选中项的背景色。 |
| selectedOptionFont | [Font](../../ui/ts-types.md#Font) | - | 设置下拉菜单选中项的文本样式: | | selectedOptionFont | [Font](../../ui/ts-types.md#Font类型) | - | 设置下拉菜单选中项的文本样式: |
| selectedOptionFontColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置下拉菜单选中项的文本颜色。 | | selectedOptionFontColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置下拉菜单选中项的文本颜色。 |
| optionBgColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置下拉菜单项的背景色。 | | optionBgColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置下拉菜单项的背景色。 |
| optionFont | [Font](../../ui/ts-types.md#Font) | - | 设置下拉菜单项的文本样式: | | optionFont | [Font](../../ui/ts-types.md#Font类型) | - | 设置下拉菜单项的文本样式: |
| optionFontColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置下拉菜单项的文本颜色。 | | optionFontColor | [ResourceColor](../../ui/ts-types.md#ResourceColor) | - | 设置下拉菜单项的文本颜色。 |
## 事件 ## 事件
| 名称 | 功能描述 | | 名称 | 功能描述 |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ----------------------------------------------------------- | ------------------------------------------------------------ |
| onSelected(callback: (index: number, value?:string) => void) | 下拉菜单选中某一项的回调。index:选中项的索引。value:选中项的值。 | | onSelect(callback: (index: number, value?:string) => void) | 下拉菜单选中某一项的回调。index:选中项的索引。value:选中项的值。 |
## 示例 ## 示例
...@@ -61,7 +61,7 @@ struct SliderExample { ...@@ -61,7 +61,7 @@ struct SliderExample {
.font({size: 30, weight:400, family: 'serif', style: FontStyle.Normal }) .font({size: 30, weight:400, family: 'serif', style: FontStyle.Normal })
.selectedOptionFont({size: 40, weight: 500, family: 'serif', style: FontStyle.Normal }) .selectedOptionFont({size: 40, weight: 500, family: 'serif', style: FontStyle.Normal })
.optionFont({size: 30, weight: 400, family: 'serif', style: FontStyle.Normal }) .optionFont({size: 30, weight: 400, family: 'serif', style: FontStyle.Normal })
.onSelected((index:number)=>{ .onSelect((index:number)=>{
console.info("Select:" + index) console.info("Select:" + index)
}) })
} }
......
...@@ -86,7 +86,8 @@ caretPosition(value:&nbsp;number): void ...@@ -86,7 +86,8 @@ caretPosition(value:&nbsp;number): void
| -------- | -------- | | -------- | -------- |
| onChange(value:&nbsp;string)&nbsp;=&gt;&nbsp;void | 输入发生变化时,触发回调。 | | onChange(value:&nbsp;string)&nbsp;=&gt;&nbsp;void | 输入发生变化时,触发回调。 |
| onSubmit(callback:&nbsp;(enterKey:&nbsp;EnterKeyType)&nbsp;=&gt;&nbsp;void) | 回车键或者软键盘回车键触发该回调,参数为当前软键盘回车键类型。 | | onSubmit(callback:&nbsp;(enterKey:&nbsp;EnterKeyType)&nbsp;=&gt;&nbsp;void) | 回车键或者软键盘回车键触发该回调,参数为当前软键盘回车键类型。 |
| onEditChanged(callback:&nbsp;(isEditing:&nbsp;boolean)&nbsp;=&gt;&nbsp;void) | 输入状态变化时,触发回调。 | | onEditChanged(callback:&nbsp;(isEditing:&nbsp;boolean)&nbsp;=&gt;&nbsp;void)<sup>(deprecated) </sup> | 输入状态变化时,触发回调。 |
| onEditChange(callback:&nbsp;(isEditing:&nbsp;boolean)&nbsp;=&gt;&nbsp;void) <sup>8+</sup>| 输入状态变化时,触发回调。 |
| onCopy<sup>8+</sup>(callback:(value:&nbsp;string)&nbsp;=&gt;&nbsp;void) | 长按输入框内部区域弹出剪贴板后,点击剪切板复制按钮,触发回调。<br/>value:复制的文本内容。 | | onCopy<sup>8+</sup>(callback:(value:&nbsp;string)&nbsp;=&gt;&nbsp;void) | 长按输入框内部区域弹出剪贴板后,点击剪切板复制按钮,触发回调。<br/>value:复制的文本内容。 |
| onCut<sup>8+</sup>(callback:(value:&nbsp;string)&nbsp;=&gt;&nbsp;void) | 长按输入框内部区域弹出剪贴板后,点击剪切板剪切按钮,触发回调。<br/>value:剪切的文本内容。 | | onCut<sup>8+</sup>(callback:(value:&nbsp;string)&nbsp;=&gt;&nbsp;void) | 长按输入框内部区域弹出剪贴板后,点击剪切板剪切按钮,触发回调。<br/>value:剪切的文本内容。 |
| onPaste<sup>8+</sup>(callback:(value:&nbsp;string)&nbsp;=&gt;&nbsp;void) | 长按输入框内部区域弹出剪贴板后,点击剪切板粘贴按钮,触发回调。<br/>value:粘贴的文本内容。 | | onPaste<sup>8+</sup>(callback:(value:&nbsp;string)&nbsp;=&gt;&nbsp;void) | 长按输入框内部区域弹出剪贴板后,点击剪切板粘贴按钮,触发回调。<br/>value:粘贴的文本内容。 |
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
## 接口 ## 接口
PanGesture(options?: { fingers?: number, direction?: PanDirection, distance?: number } | [PanGestureOption](#pangestureoption)) PanGesture(options?: { fingers?: number, direction?: PanDirection, distance?: number } | [PanGestureOptions](#pangestureoptions))
- 参数 - 参数
| 参数名称 | 参数类型 | 必填 | 默认值 | 参数描述 | | 参数名称 | 参数类型 | 必填 | 默认值 | 参数描述 |
...@@ -33,11 +33,11 @@ PanGesture(options?: { fingers?: number, direction?: PanDirection, distance?: nu ...@@ -33,11 +33,11 @@ PanGesture(options?: { fingers?: number, direction?: PanDirection, distance?: nu
| None | 任何方向都不可滑动。 | | None | 任何方向都不可滑动。 |
### PanGestureOption ### PanGestureOptions
通过PanGestureOption对象接口可以动态修改滑动手势识别器的属性,从而避免通过状态变量修改属性(状态变量修改会导致UI刷新)。 通过PanGestureOptions对象接口可以动态修改滑动手势识别器的属性,从而避免通过状态变量修改属性(状态变量修改会导致UI刷新)。
PanGestureOption(options?: { fingers?: number, direction?: PanDirection, distance?: number }) PanGestureOptions(options?: { fingers?: number, direction?: PanDirection, distance?: number })
- 参数 - 参数
同PanGesture参数说明。 同PanGesture参数说明。
......
...@@ -55,9 +55,10 @@ AlphabetIndexer(value: {arrayValue : Array&lt;string&gt;, selected : number}) ...@@ -55,9 +55,10 @@ AlphabetIndexer(value: {arrayValue : Array&lt;string&gt;, selected : number})
| 名称 | 功能描述 | | 名称 | 功能描述 |
| -------- | -------- | | -------- | -------- |
| onSelected(index:&nbsp;number)&nbsp;=&gt;&nbsp;void | 索引条选中回调。 | | onSelected(index:&nbsp;number)&nbsp;=&gt;&nbsp;void<sup>(deprecated) </sup>| 索引条选中回调。 |
| onSelect(index:&nbsp;number)&nbsp;=&gt;&nbsp;void<sup>8+</sup> | 索引条选中回调。 |
| onRequestPopupData(callback:&nbsp;(index:&nbsp;number)&nbsp;=&gt;&nbsp;Array&lt;string&gt;)<sup>8+</sup> | 选中字母索引后,请求索引提示窗口显示内容回调。<br/>返回值:索引对应的字符串数组,此字符串数组在弹出窗口中竖排显示,字符串列表最多显示5个,超出部分可以滑动显示。 | | onRequestPopupData(callback:&nbsp;(index:&nbsp;number)&nbsp;=&gt;&nbsp;Array&lt;string&gt;)<sup>8+</sup> | 选中字母索引后,请求索引提示窗口显示内容回调。<br/>返回值:索引对应的字符串数组,此字符串数组在弹出窗口中竖排显示,字符串列表最多显示5个,超出部分可以滑动显示。 |
| onPopupSelected(callback:&nbsp;(index:&nbsp;number)&nbsp;=&gt;&nbsp;void)<sup>8+</sup> | 字母索引提示窗口选中回调。 | | onPopupSelect(callback:&nbsp;(index:&nbsp;number)&nbsp;=&gt;&nbsp;void)<sup>8+</sup> | 字母索引提示窗口选中回调。 |
## 示例 ## 示例
...@@ -79,7 +80,7 @@ struct AlphabetIndexerSample { ...@@ -79,7 +80,7 @@ struct AlphabetIndexerSample {
.popupFont({ size: 30, weight: FontWeight.Bolder }) // 弹出框的演示 .popupFont({ size: 30, weight: FontWeight.Bolder }) // 弹出框的演示
.itemSize(28) // 每一项的大小正方形 .itemSize(28) // 每一项的大小正方形
.alignStyle(IndexerAlign.Left) // 左对齐 .alignStyle(IndexerAlign.Left) // 左对齐
.onSelected((index: number) => { .onSelect((index: number) => {
console.info(this.value[index] + '被选中了') // 选中的事件 console.info(this.value[index] + '被选中了') // 选中的事件
}) })
.margin({ left: 50 }) .margin({ left: 50 })
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
> 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
侧边栏容器,分为侧边栏和内容区两部分,可单独添加子组件 提供侧边栏可以显示和隐藏的侧边栏容器,通过子组件定义侧边栏和内容区,第一个子组件表示侧边栏,第二个子组件表示内容区
## 权限列表 ## 权限列表
...@@ -14,10 +14,7 @@ ...@@ -14,10 +14,7 @@
## 子组件 ## 子组件
可以包含两个子组件。 可以包含子组件。
> ![](../../public_sys-resources/icon-note.gif) **说明:**
> 第一个子组件的类型必须为[Column](ts-container-column.md),表示侧边栏,第二个子组件的类型必须为[RowSplit](ts-container-rowsplit.md),表示内容区。
## 接口 ## 接口
...@@ -42,18 +39,18 @@ SideBarContainer( type?: SideBarContainerType ) ...@@ -42,18 +39,18 @@ SideBarContainer( type?: SideBarContainerType )
| showSideBar | boolean | true | 设置是否显示侧边栏。 | | showSideBar | boolean | true | 设置是否显示侧边栏。 |
| controlButton | ButtonStyle | - | 设置侧边栏控制按钮的属性。 | | controlButton | ButtonStyle | - | 设置侧边栏控制按钮的属性。 |
| showControlButton | boolean | true | 设置是否显示控制按钮。 | | showControlButton | boolean | true | 设置是否显示控制按钮。 |
| sidebarWidth | number | 200vp | 设置侧边栏的宽度。 | | sideBarWidth | number | 200 | 设置侧边栏的宽度。 |
| minSideBarWidth | number | 200vp | 设置侧边栏最小宽度。 | | minSideBarWidth | number | 200 | 设置侧边栏最小宽度。 |
| maxSideBarWidth | number | 280vp | 设置侧边栏最大宽度。 | | maxSideBarWidth | number | 280 | 设置侧边栏最大宽度。 |
- ButtonStyle对象说明 - ButtonStyle对象说明
| 名称 | 参数类型 | 必填 | 默认值 | 描述 | | 名称 | 参数类型 | 必填 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| left | number | 否 | 16vp | 设置侧边栏控制按钮距离容器左界限的间距。 | | left | number | 否 | 16 | 设置侧边栏控制按钮距离容器左界限的间距。 |
| top | number | 否 | 48vp | 设置侧边栏控制按钮距离容器上界限的间距。 | | top | number | 否 | 48 | 设置侧边栏控制按钮距离容器上界限的间距。 |
| width | number | 否 | 32vp | 设置侧边栏控制按钮的宽度。 | | width | number | 否 | 32 | 设置侧边栏控制按钮的宽度。 |
| height | number | 否 | 32vp | 设置侧边栏控制按钮的高度。 | | height | number | 否 | 32 | 设置侧边栏控制按钮的高度。 |
| icons | {<br/>shown:&nbsp;string \| PixelMap \| [Resource](../../ui/ts-types.md#resource类型) ,<br/>hidden:&nbsp;string \| PixelMap \| [Resource](../../ui/ts-types.md#resource类型) ,<br/>switching?:&nbsp;string \| PixelMap \| [Resource](../../ui/ts-types.md#resource类型) <br/>} | 否 | - | 设置侧边栏控制按钮的图标:<br/> </p> - shown: 设置侧边栏显示时控制按钮的图标。<br>- hidden: 设置侧边栏隐藏时控制按钮的图标。<br>- switching:设置侧边栏显示和隐藏状态切换时控制按钮的图标。 | | icons | {<br/>shown:&nbsp;string \| PixelMap \| [Resource](../../ui/ts-types.md) ,<br/>hidden:&nbsp;string \| PixelMap \| [Resource](../../ui/ts-types.md) ,<br/>switching?:&nbsp;string \| PixelMap \| [Resource](../../ui/ts-types.md) <br/>} | 否 | - | 设置侧边栏控制按钮的图标:<br/> </p> - shown: 设置侧边栏显示时控制按钮的图标。<br>- hidden: 设置侧边栏隐藏时控制按钮的图标。<br>- switching:设置侧边栏显示和隐藏状态切换时控制按钮的图标。 |
...@@ -113,4 +110,5 @@ struct SideBarContainerExample { ...@@ -113,4 +110,5 @@ struct SideBarContainerExample {
} }
} }
``` ```
<img src="figures/sidebarcontainer.png" style="border: 1px solid black;" width="300" height="447" align="middle" />
![](figures/sidebarcontainer.png)
...@@ -4,12 +4,12 @@ ...@@ -4,12 +4,12 @@
> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
| 接口名称 | 功能描述 | | 接口名称 | 功能描述 |
| -------- | -------- | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| animateTo(value:&nbsp;[AnimationOption](#animationoption对象说明),&nbsp;event:&nbsp;()=&gt;&nbsp;void)&nbsp;:&nbsp;void | 提供全局animateTo显式动画接口来指定由于闭包代码导致的状态变化插入过渡动效。<br/>event指定显示动效的闭包函数,在闭包函数中导致的状态变化系统会自动插入过渡动画。 | | animateTo(value:&nbsp;[AnimationOptions](#animationoptions对象说明),&nbsp;event:&nbsp;()=&gt;&nbsp;void)&nbsp;:&nbsp;void | 提供全局animateTo显式动画接口来指定由于闭包代码导致的状态变化插入过渡动效。<br/>event指定显示动效的闭包函数,在闭包函数中导致的状态变化系统会自动插入过渡动画。 |
## AnimationOption对象说明 ## AnimationOptions对象说明
- 属性 - 属性
| 属性名称 | 属性类型 | 默认值 | 描述 | | 属性名称 | 属性类型 | 默认值 | 描述 |
......
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
## 接口 ## 接口
Video(value: VideoOption) Video(value: VideoOptions)
- VideoOption类型接口说明 - VideoOptions类型接口说明
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| src | string | 否 | - | 视频播放源的路径。 | | src | string | 否 | - | 视频播放源的路径。 |
| currentProgressRate | number&nbsp;\|&nbsp;PlaybackSpeed<sup>8+</sup> | 否 | 1.0&nbsp;\|&nbsp;PlaybackSpeed.<br>Speed_Forward_1_00_X | 视频播放倍速。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;number取值仅支持:0.75,1.0,1.25,1.75,2.0。<br/> | | currentProgressRate | number&nbsp;\|&nbsp;PlaybackSpeed<sup>8+</sup> | 否 | 1.0&nbsp;\|&nbsp;PlaybackSpeed.<br>Speed_Forward_1_00_X | 视频播放倍速。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;number取值仅支持:0.75,1.0,1.25,1.75,2.0。<br/> |
| previewUri | string&nbsp;\|&nbsp;PixelMap<sup>8+</sup>&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#resource类型) | 否 | - | 预览图片的路径。 | | previewUri | string&nbsp;\|&nbsp;PixelMap<sup>8+</sup>&nbsp;\|&nbsp;[Resource](../../ui/ts-types.md#Resource类型) | 否 | - | 预览图片的路径。 |
| controller | [VideoController](#videocontroller) | 否 | - | 控制器。 | | controller | [VideoController](#videocontroller) | 否 | - | 控制器。 |
......
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
## TextPickerDialog.show ## TextPickerDialog.show
show(options: TextPickerDialogOption) show(options: TextPickerDialogOptions)
定义文本滑动选择器弹窗并弹出。 定义文本滑动选择器弹窗并弹出。
- TextPickerDialogOption参数 - TextPickerDialogOptions参数
| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| range | string[] | 是 | - | 选择器的数据选择范围。 | | range | string[] | 是 | - | 选择器的数据选择范围。 |
......
# 点击控制 # 点击控制
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。
## 权限列表 ## 权限列表
......
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
| hoverEffect | HoverEffect | HoverEffect.Auto | 设置当前组件悬停态下的悬浮效果。 | | hoverEffect | HoverEffect | HoverEffect.Auto | 设置当前组件悬停态下的悬浮效果。 |
- HoverEffect 枚举说明 - HoverEffect 枚举说明
| 名称 | 描述 | | 名称 | 描述 |
| -------- | -------- | | -------- | -------- |
| Auto | 使用组件的系统默认悬浮效果。 | | Auto | 使用组件的系统默认悬浮效果。 |
| Scale | 放大缩小效果。 | | Scale | 放大缩小效果。 |
| Board | 背景淡入淡出效果。 | | Highlight | 背景淡入淡出的强调效果。 |
| None | 不设置效果。 | | None | 不设置效果。 |
## 示例 ## 示例
...@@ -41,17 +41,17 @@ struct HoverExample { ...@@ -41,17 +41,17 @@ struct HoverExample {
.position({ x: 40, y: 120 }) .position({ x: 40, y: 120 })
.hoverEffect(HoverEffect.Scale) .hoverEffect(HoverEffect.Scale)
.onHover((isHover: boolean) => { .onHover((isHover: boolean) => {
console.info('Scale' + isHover) console.info('Scale isHover: ' + isHover)
this.isHoverVal = isHover this.isHoverVal = isHover
}) })
Text('Board').fontSize(20).fontColor(Color.Gray).width('90%').position({ x: 0, y: 380 }) Text('Board').fontSize(20).fontColor(Color.Gray).width('90%').position({ x: 0, y: 380 })
Column() Column()
.width('80%').height(200).backgroundColor(Color.Gray) .width('80%').height(200).backgroundColor(Color.Gray)
.hoverEffect(HoverEffect.Board) .hoverEffect(HoverEffect.Highlight)
.position({ x: 40, y: 420 }) .position({ x: 40, y: 420 })
.onHover((isHover: boolean) => { .onHover((isHover: boolean) => {
console.info('HoverEffect.Board') console.info('Highlight isHover: ' +isHover )
this.isHoverVal = isHover this.isHoverVal = isHover
}) })
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| stateStyle | StateStyles | - | 设置组件不同状态的样式。 | | stateStyles | StateStyles | - | 设置组件不同状态的样式。 |
- StateStyles接口说明 - StateStyles接口说明
| 名称 | 类型 | 必填 | 默认值 | 描述 | | 名称 | 类型 | 必填 | 默认值 | 描述 |
......
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| bindPopup | show:&nbsp;boolean,<br/>popup:&nbsp;PopupOption\|&nbsp;CustomPopupOption | - | 给组件绑定Popup,点击弹出弹窗。<br/>show:&nbsp;创建页面弹窗提示是否默认显示,默认值为false。<br/>popup:&nbsp;配置当前弹窗提示的参数。 | | bindPopup | show:&nbsp;boolean,<br/>popup:&nbsp;PopupOptions\|&nbsp;CustomPopupOptions | - | 给组件绑定Popup,点击弹出弹窗。<br/>show:&nbsp;创建页面弹窗提示是否默认显示,默认值为false。<br/>popup:&nbsp;配置当前弹窗提示的参数。 |
- PopupOption类型接口说明 - PopupOptions类型接口说明
| 名称 | 类型 | 必填 | 默认值 | 描述 | | 名称 | 类型 | 必填 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| message | string | 是 | - | 弹窗信息内容。 | | message | string | 是 | - | 弹窗信息内容。 |
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
| secondaryButton | {<br/>value:&nbsp;string,<br/>action:&nbsp;()&nbsp;=&gt;&nbsp;void<br/>} | 否 | - | 第二个按钮。<br/>value:&nbsp;弹窗里辅助按钮的文本。<br/>action:&nbsp;点击辅助按钮的回调函数。 | | secondaryButton | {<br/>value:&nbsp;string,<br/>action:&nbsp;()&nbsp;=&gt;&nbsp;void<br/>} | 否 | - | 第二个按钮。<br/>value:&nbsp;弹窗里辅助按钮的文本。<br/>action:&nbsp;点击辅助按钮的回调函数。 |
| onStateChange | (isVisible:&nbsp;boolean)&nbsp;=&gt;&nbsp;void | 否 | - | 弹窗状态变化事件回调,参数isVisible为弹窗当前的显示状态。 | | onStateChange | (isVisible:&nbsp;boolean)&nbsp;=&gt;&nbsp;void | 否 | - | 弹窗状态变化事件回调,参数isVisible为弹窗当前的显示状态。 |
- CustomPopupOption<sup>8+</sup>类型接口说明 - CustomPopupOptions<sup>8+</sup>类型接口说明
| 名称 | 类型 | 必填 | 默认值 | 描述 | | 名称 | 类型 | 必填 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
| builder | ()&nbsp;=&gt;&nbsp;any | 是 | - | 提示气泡内容的构造器。 | | builder | ()&nbsp;=&gt;&nbsp;any | 是 | - | 提示气泡内容的构造器。 |
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
| -------- | -------- | -------- | | -------- | -------- | -------- |
| width | number | 目标元素的宽度,单位为vp。 | | width | number | 目标元素的宽度,单位为vp。 |
| height | number | 目标元素的高度,单位为vp。 | | height | number | 目标元素的高度,单位为vp。 |
| pos | Position | 目标元素左上角相对父元素左上角的位置。 | | position | Position | 目标元素左上角相对父元素左上角的位置。 |
| globalPos | Position | 目标元素左上角相对页面左上角的位置。 | | globalPosition | Position | 目标元素左上角相对页面左上角的位置。 |
- Position<sup>8+</sup>对象说明 - Position<sup>8+</sup>对象说明
| 属性名称 | 参数类型 | 描述 | | 属性名称 | 参数类型 | 描述 |
......
...@@ -27,21 +27,45 @@ ...@@ -27,21 +27,45 @@
- [事件](ui-js-building-ui-event.md) - [事件](ui-js-building-ui-event.md)
- [页面路由](ui-js-building-ui-routes.md) - [页面路由](ui-js-building-ui-routes.md)
- 常见组件开发指导 - 常见组件开发指导
- [Text](ui-js-components-text.md) - 容器组件
- [Input](ui-js-components-input.md) - [List开发指导](ui-js-components-list.md)
- [Button](ui-js-components-button.md) - [Dialog开发指导](ui-js-components-dialog.md)
- [List](ui-js-components-list.md) - [Form开发指导](ui-js-components-form.md)
- [Picker](ui-js-components-picker.md) - [Stepper开发指导](ui-js-components-stepper.md)
- [Dialog](ui-js-components-dialog.md) - [Tabs开发指导](ui-js-component-tabs.md)
- [Form](ui-js-components-form.md) - [Swiper开发指导](ui-js-components-swiper.md)
- [Stepper](ui-js-components-stepper.md) - 基础组件
- [Tabs](ui-js-component-tabs.md) - [Text开发指导](ui-js-components-text.md)
- [Image](ui-js-components-images.md) - [Input开发指导](ui-js-components-input.md)
- [Button开发指导](ui-js-components-button.md)
- [Picker开发指导](ui-js-components-picker.md)
- [Image开发指导](ui-js-components-images.md)
- [Image-animator开发指导](ui-js-components-image-animator.md)
- [Rating开发指导](ui-js-components-rating.md)
- [Slider开发指导](ui-js-components-slider.md)
- [Chart开发指导](ui-js-components-chart.md)
- [Switch开发指导](ui-js-components-switch.md)
- [Toolbar开发指导](ui-js-components-toolbar.md)
- [Menu开发指导](ui-js-components-menu.md)
- [Marquee开发指导](ui-js-components-marquee.md)
- [Qrcode开发指导](ui-js-components-qrcode.md)
- [Search开发指导](ui-js-components-search.md)
- Canvas开发指导
- [CanvasRenderingContext2D对象](ui-js-components-canvasrenderingcontext2d.md)
- [Path2D对象](ui-js-components-path2d.md)
- [OffscreenCanvas对象](ui-js-components-offscreencanvas.md)
- [栅格布局](ui-js-components-calendar.md)
- Svg开发指导
- [基础知识](ui-js-components-svg-overview.md)
- [绘制图形](ui-js-components-svg-graphics.md)
- [绘制路径](ui-js-components-svg-path.md)
- [绘制文本](ui-js-components-svg-text.md)
- 动效开发指导 - 动效开发指导
- CSS动画 - CSS动画
- [属性样式动画](ui-js-animate-attribute-style.md) - [属性样式动画](ui-js-animate-attribute-style.md)
- [transform样式动画](ui-js-animate-transform.md) - [transform样式动画](ui-js-animate-transform.md)
- [background-position样式动画](ui-js-animate-background-position-style.md) - [background-position样式动画](ui-js-animate-background-position-style.md)
- [svg动画](ui-js-animate-svg.md)
- JS动画 - JS动画
- [组件动画](ui-js-animate-component.md) - [组件动画](ui-js-animate-component.md)
- 插值器动画 - 插值器动画
......
...@@ -19,10 +19,10 @@ interface IDataSource { ...@@ -19,10 +19,10 @@ interface IDataSource {
interface DataChangeListener { interface DataChangeListener {
onDataReloaded(): void; // Called while data reloaded onDataReloaded(): void; // Called while data reloaded
onDataAdded(index: number): void; // Called while single data added onDataAdd(index: number): void; // Called while single data added
onDataMoved(from: number, to: number): void; // Called while single data moved onDataMove(from: number, to: number): void; // Called while single data moved
onDataDeleted(index: number): void; // Called while single data deleted onDataDelete(index: number): void; // Called while single data deleted
onDataChanged(index: number): void; // Called while single data changed onDataChange(index: number): void; // Called while single data changed
} }
``` ```
...@@ -55,13 +55,17 @@ LazyForEach(dataSource: IDataSource, itemGenerator: (item: any) =&gt; void, keyG ...@@ -55,13 +55,17 @@ LazyForEach(dataSource: IDataSource, itemGenerator: (item: any) =&gt; void, keyG
**表3** DataChangeListener类型说明 **表3** DataChangeListener类型说明
| 名称 | 描述 | | 名称 | 描述 |
| -------- | -------- | | -------- | -------- |
| onDataReloaded():&nbsp;void | 重新加载所有数据。 | | onDataReloaded():&nbsp;void | 重新加载所有数据。 |
| onDataAdded(index:&nbsp;number):&nbsp;void | 通知组件index的位置有数据添加。 | | onDataAdded(index:&nbsp;number):&nbsp;void <sup>(deprecated) </sup>| 通知组件index的位置有数据添加。 |
| onDataMoved(from:&nbsp;number,&nbsp;to:&nbsp;number):&nbsp;void | 通知组件数据从from的位置移到to的位置。 | | onDataMoved(from:&nbsp;number,&nbsp;to:&nbsp;number):&nbsp;void <sup>(deprecated) </sup>| 通知组件数据从from的位置移到to的位置。 |
| onDataDeleted(index:&nbsp;number):&nbsp;void | 通知组件index的位置有数据删除。 | | onDataDeleted(index:&nbsp;number):&nbsp;void <sup>(deprecated) </sup>| 通知组件index的位置有数据删除。 |
| onDataChanged(index:&nbsp;number):&nbsp;void | 通知组件index的位置有数据变化。 | | onDataChanged(index:&nbsp;number):&nbsp;void <sup>(deprecated) </sup>| 通知组件index的位置有数据变化。 |
| onDataAdd(index:&nbsp;number):&nbsp;void <sup>8+</sup> | 通知组件index的位置有数据添加。 |
| onDataMove(from:&nbsp;number,&nbsp;to:&nbsp;number):&nbsp;void <sup>8+</sup> | 通知组件数据从from的位置移到to的位置。 |
| onDataDelete(index:&nbsp;number):&nbsp;void <sup>8+</sup> | 通知组件index的位置有数据删除。 |
| onDataChange(index:&nbsp;number):&nbsp;void <sup>8+</sup> | 通知组件index的位置有数据变化。 |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
...@@ -73,7 +77,7 @@ LazyForEach(dataSource: IDataSource, itemGenerator: (item: any) =&gt; void, keyG ...@@ -73,7 +77,7 @@ LazyForEach(dataSource: IDataSource, itemGenerator: (item: any) =&gt; void, keyG
> >
> - 允许**LazyForEach**包含在**if/else**条件渲染语句中,不允许**LazyForEach**中出现**if/else**条件渲染语句; > - 允许**LazyForEach**包含在**if/else**条件渲染语句中,不允许**LazyForEach**中出现**if/else**条件渲染语句;
> >
> - 为了高性能渲染,通过DataChangeListener对象的onDataChanged方法来更新UI时,仅itemGenerator中的UI描述的组件内使用了状态变量时,才会触发组件刷新; > - 为了高性能渲染,通过DataChangeListener对象的onDataChange方法来更新UI时,仅itemGenerator中的UI描述的组件内使用了状态变量时,才会触发组件刷新;
> >
> - 子项生成器函数的调用顺序不一定和数据源中的数据项相同,在开发过程中不要假设子项生成器和键值生成器函数是否执行以及执行顺序。如下示例可能无法正常工作: > - 子项生成器函数的调用顺序不一定和数据源中的数据项相同,在开发过程中不要假设子项生成器和键值生成器函数是否执行以及执行顺序。如下示例可能无法正常工作:
> ``` > ```
...@@ -124,22 +128,22 @@ class BasicDataSource implements IDataSource { ...@@ -124,22 +128,22 @@ class BasicDataSource implements IDataSource {
} }
notifyDataAdd(index: number): void { notifyDataAdd(index: number): void {
this.listeners.forEach(listener => { this.listeners.forEach(listener => {
listener.onDataAdded(index) listener.onDataAdd(index)
}) })
} }
notifyDataChange(index: number): void { notifyDataChange(index: number): void {
this.listeners.forEach(listener => { this.listeners.forEach(listener => {
listener.onDataChanged(index) listener.onDataChange(index)
}) })
} }
notifyDataDelete(index: number): void { notifyDataDelete(index: number): void {
this.listeners.forEach(listener => { this.listeners.forEach(listener => {
listener.onDataDeleted(index) listener.onDataDelete(index)
}) })
} }
notifyDataMove(from: number, to: number): void { notifyDataMove(from: number, to: number): void {
this.listeners.forEach(listener => { this.listeners.forEach(listener => {
listener.onDataMoved(from, to) listener.onDataMove(from, to)
}) })
} }
} }
......
...@@ -90,6 +90,11 @@ ...@@ -90,6 +90,11 @@
| -------- | -------- | -------- | | -------- | -------- | -------- |
| ResourceColor | Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;Resource | 用于描述资源颜色类型。 | | ResourceColor | Color&nbsp;\|&nbsp;number&nbsp;\|&nbsp;string&nbsp;\|&nbsp;Resource | 用于描述资源颜色类型。 |
## Font类型<sup>8+</sup>
| 名称 | 类型定义 | 描述 |
| -------- | -------- | -------- |
| Font | {<br/>size?: Length;<br/>weight?: <a href="https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md#li24391125115311">FontWeight</a> &nbsp;\| number &nbsp;\| string;<br/>family?: string &nbsp;\| <a href="ts-types.md#Resource">Resource</a>;<br/>style?: <a href="https://gitee.com/superFat/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md#li6906111945316">FontStyle</a>;<br/>} | 设置文本样式:<br/>size: 设置文本尺寸,Length为number类型时,使用fp单位。<br/>weight: 设置文本的字体粗细,number类型取值[100, 900],取值间隔为100,默认为400,取值越大,字体越粗。<br/>family: 设置文本的字体列表。使用多个字体,使用','进行分割,优先级按顺序生效。例如:'Arial, sans-serif'。<br/>style: 设置文本的字体样式。 |
## CustomBuilder类型<sup>8+</sup> ## CustomBuilder类型<sup>8+</sup>
......
...@@ -46,7 +46,7 @@ sudo apt-get install build-essential gcc g++ make libffi-dev e2fsprogs pkg-confi ...@@ -46,7 +46,7 @@ sudo apt-get install build-essential gcc g++ make libffi-dev e2fsprogs pkg-confi
source ~/.bashrc source ~/.bashrc
``` ```
3. 执行"hb -h",界面打印以下信息即表示安装成功: 3. 在源码目录执行"hb -h",界面打印以下信息即表示安装成功:
``` ```
usage: hb usage: hb
......
# 了解OpenHarmony
- [了解OpenHarmony开源项目](OpenHarmony-Overview_zh.md)
- [术语](device-dev/glossary/glossary.md)
- 版本说明
- OpenHarmony 3.x Releases
- [OpenHarmony v3.1 Beta (2021-12-31)](release-notes/OpenHarmony-v3.1-beta.md)
- [OpenHarmony v3.0.1 LTS (2022-01-12)](release-notes/OpenHarmony-v3.0.1-LTS.md)
- [OpenHarmony v3.0 LTS (2021-09-30)](release-notes/OpenHarmony-v3.0-LTS.md)
- OpenHarmony 2.x Releases
- [OpenHarmony v2.2 beta2 (2021-08-04)](release-notes/OpenHarmony-v2.2-beta2.md)
- [OpenHarmony 2.0 Canary (2021-06-01)](release-notes/OpenHarmony-2-0-Canary.md)
- OpenHarmony 1.x Releases
- [OpenHarmony v1.1.4 LTS (2022-02-11)](release-notes/OpenHarmony-v1-1-4-LTS.md)
- [OpenHarmony v1.1.3 LTS (2021-09-30)](release-notes/OpenHarmony-v1-1-3-LTS.md)
- [OpenHarmony v1.1.2 LTS (2021-08-04)](release-notes/OpenHarmony-v1.1.2-LTS.md)
- [OpenHarmony 1.1.1 LTS (2021-06-22)](release-notes/OpenHarmony-1-1-1-LTS.md)
- [OpenHarmony 1.1.0 LTS (2021-04-01)](release-notes/OpenHarmony-1-1-0-LTS.md)
- [OpenHarmony 1.0 (2020-09-10)](release-notes/OpenHarmony-1-0.md)
- 贡献
- [参与贡献](contribute/参与贡献.md)
- [行为准则](contribute/行为准则.md)
- [贡献代码](contribute/贡献代码.md)
- [贡献流程](contribute/贡献流程.md)
- [自测试验证](readme/测试子系统.md)
- [贡献文档](contribute/贡献文档.md)
- [写作规范](contribute/写作规范.md)
- [社区沟通与交流](contribute/社区沟通与交流.md)
- [FAQ](contribute/FAQ.md)
\ No newline at end of file
...@@ -45,6 +45,26 @@ ...@@ -45,6 +45,26 @@
## 源码获取 ## 源码获取
### 前提条件
1. 注册码云gitee账号。
2. 注册码云SSH公钥,请参考[码云帮助中心](https://gitee.com/help/articles/4191)
3. 安装[git客户端](https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git)[git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading)并配置用户信息。
```
git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store
```
4. 安装码云repo工具,可以执行如下命令。
```
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo #如果没有权限,可下载至其他目录,并将其配置到环境变量中
chmod a+x /usr/local/bin/repo
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
```
### 通过repo获取 ### 通过repo获取
...@@ -159,7 +179,7 @@ _[Changelog](api-change/v3.1-beta/changelog-v3.1-beta.md)_ ...@@ -159,7 +179,7 @@ _[Changelog](api-change/v3.1-beta/changelog-v3.1-beta.md)_
| [字符串编解码](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/StringCodec) | 本示例对字符串进行了特定格式的输出,对错误码的内容进行了文本输出,对字符串的编码和解码做了演示结果。 | eTS | | [字符串编解码](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/StringCodec) | 本示例对字符串进行了特定格式的输出,对错误码的内容进行了文本输出,对字符串的编码和解码做了演示结果。 | eTS |
| [Js音频播放和管理](https://gitee.com/openharmony/app_samples/tree/master/media/JsAudioPlayer) | 本示例展示了JS音频播放的使用方法,以及音频的音量大小设置。 | JS | | [Js音频播放和管理](https://gitee.com/openharmony/app_samples/tree/master/media/JsAudioPlayer) | 本示例展示了JS音频播放的使用方法,以及音频的音量大小设置。 | JS |
| [JsVideo](https://gitee.com/openharmony/app_samples/tree/master/media/JsVideo) | 本示例使用JS&nbsp;UI中的&lt;video/&gt;组件,实现视频播放。可以通过video自带的控制栏进行播放、暂停等操作。 | JS | | [JsVideo](https://gitee.com/openharmony/app_samples/tree/master/media/JsVideo) | 本示例使用JS&nbsp;UI中的&lt;video/&gt;组件,实现视频播放。可以通过video自带的控制栏进行播放、暂停等操作。 | JS |
| [测试打点](https://gitee.com/openharmony/app_samples/tree/master/security/JsDotTest) | 本示例展示了测试打点功能,包括应用打点与性能打点两部分。 | JS | | [测试打点](https://gitee.com/openharmony/app_samples/tree/master/DFX/JsDotTest) | 本示例展示了测试打点功能,包括应用打点与性能打点两部分。 | JS |
| [JsWorker](https://gitee.com/openharmony/app_samples/tree/master/thread/JsWorker) | 本示例展示了在JS中如何启动一个worker线程,并实现worker线程和宿主线程的通信。 | JS | | [JsWorker](https://gitee.com/openharmony/app_samples/tree/master/thread/JsWorker) | 本示例展示了在JS中如何启动一个worker线程,并实现worker线程和宿主线程的通信。 | JS |
| [画布组件](https://gitee.com/openharmony/app_samples/tree/master/UI/JsCanvas) | &lt;canvas/>组件可以自定义绘制图形,本示例展示了&lt;canvas\>组件的使用方法 | JS | | [画布组件](https://gitee.com/openharmony/app_samples/tree/master/UI/JsCanvas) | &lt;canvas/>组件可以自定义绘制图形,本示例展示了&lt;canvas\>组件的使用方法 | JS |
| [JS页面弹窗](https://gitee.com/openharmony/app_samples/tree/master/UI/JsDialog) | JS中支持用户自定义弹窗,&lt;dialog/&gt;组件作为容器组件,用户可以自定义弹窗的样式和布局。本示例完成了添加和删除联系人功能,在添加和删除时使用自定义弹窗来实现。 | JS | | [JS页面弹窗](https://gitee.com/openharmony/app_samples/tree/master/UI/JsDialog) | JS中支持用户自定义弹窗,&lt;dialog/&gt;组件作为容器组件,用户可以自定义弹窗的样式和布局。本示例完成了添加和删除联系人功能,在添加和删除时使用自定义弹窗来实现。 | JS |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册