提交 4a5d3bb3 编写于 作者: 朱天怡 提交者: Gitee

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

Signed-off-by: N朱天怡 <zhutianyi2@huawei.com>
......@@ -164,6 +164,23 @@ zh-cn/application-dev/reference/arkui-js/ @HelloCrease
zh-cn/application-dev/reference/arkui-ts/ @HelloCrease
zh-cn/application-dev/reference/native-apis @RayShih
zh-cn/application-dev/reference/native-lib @RayShih
zh-cn/application-dev/quick-start/start-overview.md @ge-yafang
zh-cn/application-dev/quick-start/start-with-ets.md @ge-yafang
zh-cn/application-dev/quick-start/start-with-ets-low-code.md @ge-yafang
zh-cn/application-dev/quick-start/start-with-js.md @ge-yafang
zh-cn/application-dev/quick-start/start-with-js-low-code.md @ge-yafang
zh-cn/application-dev/quick-start/deveco-studio-user-guide-for-openharmony.md @ge-yafang
zh-cn/application-dev/quick-start/package-structure.md @RayShih
zh-cn/application-dev/quick-start/basic-resource-file-categories.md @RayShih
zh-cn/application-dev/quick-start/syscap.md @RayShih
zh-cn/application-dev/napi/napi-guidelines.md @RayShih
zh-cn/application-dev/napi/drawing-guidelines.md @ge-yafang
zh-cn/application-dev/napi/rawfile-guidelines.md @HelloCrease
zh-cn/application-dev/reference/js-service-widget-ui/ @HelloCrease
zh-cn/application-dev/website.md @zengyawen
zh-cn/application-dev/faqs/ @zengyawen
zh-cn/application-dev/file-management/ @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-DataUriUtils.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-ability-errorCode.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md @RayShih
......@@ -186,7 +203,6 @@ zh-cn/application-dev/reference/apis/js-apis-particleAbility.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-service-extension-ability.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-application-StartOptions.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-application-Want.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-wantAgent.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md @RayShih
......@@ -277,15 +293,15 @@ zh-cn/application-dev/reference/apis/js-apis-http.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-request.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-socket.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-webSocket.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-nfcTag.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-nfcTech.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-tagSession.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-connectedTag.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-nfcTag.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-nfcTech.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-tagSession.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-connectedTag.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-rpc.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-wifi.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-wifiext.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-accessibility.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-wifi.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-wifiext.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-accessibility.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-faultLogger.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hiappevent.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hichecker.md @zengyawen
......@@ -293,31 +309,31 @@ zh-cn/application-dev/reference/apis/js-apis-hidebug.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hilog.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hitracechain.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hitracemeter.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-system-time.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-system-time.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-timer.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-battery-info.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-brightness.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-device-info.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-battery-info.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-brightness.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-device-info.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-device-manager.md
zh-cn/application-dev/reference/apis/js-apis-geolocation.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-geolocation.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-inputconsumer.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-inputdevice.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-inputeventclient.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-inputmonitor.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-power.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-runninglock.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-power.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-runninglock.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-sensor.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-system-sensor.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-system-parameter.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-thermal.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-system-parameter.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-thermal.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-update.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-usb.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-colorSpaceManager.mdd @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-colorSpaceManager.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-vibrator.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-appAccount.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-distributed-account.md @zengyawen
......@@ -349,24 +365,83 @@ zh-cn/application-dev/reference/apis/js-apis-hisysevent.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-privacyManager.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-uiappearance.md @HelloCrease
zh-cn/application-dev/quick-start/start-overview.md @ge-yafang
zh-cn/application-dev/quick-start/start-with-ets.md @ge-yafang
zh-cn/application-dev/quick-start/start-with-ets-low-code.md @ge-yafang
zh-cn/application-dev/quick-start/start-with-js.md @ge-yafang
zh-cn/application-dev/quick-start/start-with-js-low-code.md @ge-yafang
zh-cn/application-dev/quick-start/deveco-studio-user-guide-for-openharmony.md @ge-yafang
zh-cn/application-dev/quick-start/package-structure.md @RayShih
zh-cn/application-dev/quick-start/basic-resource-file-categories.md @RayShih
zh-cn/application-dev/quick-start/syscap.md @RayShih
zh-cn/application-dev/napi/napi-guidelines.md @RayShih
zh-cn/application-dev/napi/drawing-guidelines.md @ge-yafang
zh-cn/application-dev/napi/rawfile-guidelines.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-buffer.md @zengyawen
zh-cn/application-dev/reference/js-service-widget-ui @HelloCrease
zh-cn/application-dev/website.md @zengyawen
zh-cn/application-dev/faqs/ @zengyawen
zh-cn/application-dev/reference/apis/js-apis-useriam-faceauth.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-userfilemanager.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-buffer.md @zengyawen
zh-cn/application-dev/reference/apis/Readme-CN.md @zengyawen
zh-cn/application-dev/file-management/ @qinxiaowang
\ No newline at end of file
zh-cn/application-dev/reference/apis/development-intro.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-accessibility-extension-context.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-application-abilityManager.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-application-AccessibilityExtensionAbility.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-application-applicationContext.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-application-EnvironmentCallback.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-AbilityInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-CustomizeData.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-ElementName.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-HapModuleInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-Metadata.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-ModuleInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-ShortcutInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bytrace.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationManager.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationResult.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-dispatchInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-distributedMissionManager.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-errorManager.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-inputevent.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-ability.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-keycode.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-keyevent.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-logs.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-mouseevent.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-nfcController.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-nfctech.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-pointer.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-processrunninginformation.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-securityLabel.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-system-app.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-system-battery.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-system-brightness.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-system-configuration.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-system-device.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-system-fetch.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-system-file.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-system-location.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-system-mediaquery.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-system-network.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-system-notification.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-system-package.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-system-prompt.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-system-request.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-system-router.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-system-timer.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-touchevent.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-accessibility-config.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-application-quickFixManager.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-bundle-PackInfo.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-enterpriseDeviceManager-DeviceSettingsManager.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-fileAccess.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-fileExtensionInfo.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-net-policy.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-net-sharing.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-net-statistics.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-tlsSocket.md @zengyawen
......@@ -56,7 +56,7 @@ The methods are used to set the display orientation of the current ability.
**Example**
```javascript
import featureAbility from '@ohos.ability.featureAbility'
import bundle from '../@ohos.bundle';
import bundle from '@ohos.bundle';
export default {
onCreate() {
......@@ -79,7 +79,7 @@ The following describes the contexts provided by the stage model in detail.
### application/Context
**application/Context** is the base class context that provides basic application information such as **resourceManager**, **applicationInfo**, **cacheDir**, and **area**. It also provides basic application methods such as **createBundleContext**.
**application/Context** is the base class context. It provides basic application information, such as **resourceManager**, **applicationInfo**, **cacheDir**, and **area**. It also provides basic application methods such as **createModuleContext**.
**d.ts statement**
......
......@@ -12,8 +12,8 @@ An ability can be launched in the **standard**, **singleton**, or **specified**
| Launch Type | Description |Action |
| ----------- | ------- |---------------- |
| standard | Multi-instance | A new instance is started each time an ability starts.|
| singleton | Singleton | The ability has only one instance in the system. If an instance already exists when an ability is started, that instance is reused.|
| standard | Standard mode. | A new instance is started each time an ability starts.|
| singleton | Singleton mode. | The ability has only one instance in the system. If an instance already exists when an ability is started, that instance is reused.|
| specified | Instance-specific| The internal service of an ability determines whether to create multiple instances during running.|
By default, the singleton mode is used. The following is an example of the `module.json5` file:
......
......@@ -52,9 +52,9 @@ Examples are given below.
3. Implement the data provider services. For example, implement data storage of the data provider by using a database, reading and writing files, or accessing the network.
```ts
let DB_NAME = "DB00.db";
let TBL_NAME = "TBL00";
let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
const DB_NAME = "DB00.db";
const TBL_NAME = "TBL00";
const DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
+ TBL_NAME
+ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, isStudent BOOLEAN, Binary BINARY)";
......@@ -132,9 +132,9 @@ Examples are given below.
1. Import the dependencies.
```ts
import Ability from '@ohos.application.Ability'
import dataShare from '@ohos.data.dataShare'
import dataSharePredicates from '@ohos.data.dataSharePredicates'
import Ability from '@ohos.application.Ability';
import dataShare from '@ohos.data.dataShare';
import dataSharePredicates from '@ohos.data.dataSharePredicates';
```
2. Define the URI string for communicating with the data provider.
......@@ -164,29 +164,25 @@ Examples are given below.
```ts
// Construct a piece of data.
var valuesBucket = { "name": "ZhangSan", "age": 21, "isStudent": false, "Binary": new Uint8Array([1, 2, 3]) };
var updateBucket = { "name": "LiSi", "age": 18, "isStudent": true, "Binary": new Uint8Array([1, 2, 3]) };
let da = new dataSharePredicates.DataSharePredicates();
var valArray = new Array("*");
let people = new Array(
{ "name": "LiSi", "age": 41, "Binary": ar },
{ "name": "WangWu", "age": 21, "Binary": arr },
{ "name": "ZhaoLiu", "age": 61, "Binary": arr });
let valuesBucket = { "name": "ZhangSan", "age": 21, "isStudent": false, "Binary": new Uint8Array([1, 2, 3]) };
let updateBucket = { "name": "LiSi", "age": 18, "isStudent": true, "Binary": new Uint8Array([1, 2, 3]) };
let predicates = new dataSharePredicates.DataSharePredicates();
let valArray = new Array("*");
// Insert a piece of data.
dsHelper.insert(dseUri, valuesBucket, (err, data) => {
console.log("dsHelper insert result: " + data);
});
// Delete data.
dsHelper.delete(dseUri, da, (err, data) => {
console.log("dsHelper delete result: " + data);
});
// Update data.
dsHelper.update(dseUri, da, updateBucket, (err, data) => {
dsHelper.update(dseUri, predicates, updateBucket, (err, data) => {
console.log("dsHelper update result: " + data);
});
// Query data.
dsHelper.query(dseUri, da, valArray, (err, data) => {
dsHelper.query(dseUri, predicates, valArray, (err, data) => {
console.log("dsHelper query result: " + data);
});
// Delete data.
dsHelper.delete(dseUri, predicates, (err, data) => {
console.log("dsHelper delete result: " + data);
});
```
......@@ -22,7 +22,7 @@ Before you get started, familiarize yourself with the following concepts:
An application that accesses the data or services provided by a data provider. It is also called a client.
- Value bucket (**ValuesBucket**)
- **ValuesBucket**
One or more data records stored in the form of key-value (KV) pairs. The keys are of the string type. The values can be of the number, string, Boolean, or Unit8Array type.
......
......@@ -12,7 +12,7 @@ The distributed data object management framework provides object-oriented in-mem
- **Distributed data object**
A distributed data object is an encapsulation of the JS object type. Each distributed data object instance creates a data table in the in-memory database. The in-memory databases created for different applications are isolated from each other. Reading data from and writing data to a distributed data object are mapped to the **put** and **get** operations in the corresponding database, respectively.
A distributed data object is an encapsulation of the JS object type. Each distributed data object instance creates a data table in the in-memory database. The in-memory databases created for different applications are isolated from each other. Reading data from and writing data to a distributed data object are mapped to the **get** and **put** operations in the corresponding database, respectively.
The distributed data object can be in the following states in its lifecycle:
......
......@@ -88,15 +88,22 @@ Use the following APIs to delete a **Preferences** instance or data file.
2. Obtain a **Preferences** instance.
Read the specified file and load its data to the **Preferences** instance for data operations.
FA model:
```js
// Obtain the context.
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext()
let context = featureAbility.getContext();
let preferences = null;
let promise = data_preferences.getPreferences(context, 'mystore');
promise.then((pref) => {
preferences = pref;
}).catch((err) => {
console.info("Failed to get the preferences.");
})
```
Stage model:
......@@ -104,14 +111,21 @@ Use the following APIs to delete a **Preferences** instance or data file.
```ts
// Obtain the context.
import Ability from '@ohos.application.Ability'
var context
class MainAbility extends Ability{
let context = null;
let preferences = null;
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage){
context = this.context
context = this.context;
}
}
let promise = data_preferences.getPreferences(context, 'mystore');
promise.then((pref) => {
preferences = pref;
}).catch((err) => {
console.info("Failed to get the preferences.");
})
```
3. Write data.
......@@ -119,35 +133,27 @@ Use the following APIs to delete a **Preferences** instance or data file.
Use the **preferences.put()** method to write data to the **Preferences** instance.
```js
promise.then((preferences) => {
let putPromise = preferences.put('startup', 'auto');
putPromise.then(() => {
console.info("Put the value of 'startup' successfully.");
}).catch((err) => {
console.info("Failed to put the value of 'startup'. Cause: " + err);
})
let putPromise = preferences.put('startup', 'auto');
putPromise.then(() => {
console.info("Put the value of 'startup' successfully.");
}).catch((err) => {
console.info("Failed to get the preferences.");
console.info("Failed to put the value of 'startup'. Cause: " + err);
})
```
4. Read data.
Use the **preferences.get()** method to read data.
```js
promise.then((preferences) => {
let getPromise = preferences.get('startup', 'default');
getPromise.then((value) => {
let getPromise = preferences.get('startup', 'default');
getPromise.then((value) => {
console.info("The value of 'startup' is " + value);
}).catch((err) => {
console.info("Failed to get the value of 'startup'. Cause: " + err);
})
}).catch((err) => {
console.info("Failed to get the preferences.")
});
console.info("Failed to get the value of 'startup'. Cause: " + err);
})
```
5. Store data persistently.
Use the **flush()** method to flush data from the **Preferences** instance to its file.
......@@ -161,11 +167,12 @@ Use the following APIs to delete a **Preferences** instance or data file.
Specify an observer as the callback to subscribe to data changes for an application. When the value of the subscribed key is changed and saved by **flush()**, the observer callback will be invoked to return the new data.
```js
var observer = function (key) {
let observer = function (key) {
console.info("The key" + key + " changed.");
}
preferences.on('change', observer);
preferences.put('startup', 'auto', function (err) {
// The data is changed from 'auto' to 'manual'.
preferences.put('startup', 'manual', function (err) {
if (err) {
console.info("Failed to put the value of 'startup'. Cause: " + err);
return;
......
......@@ -140,7 +140,7 @@ You can obtain the distributed table name for a remote device based on the local
| Class | API | Description |
| -------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| RdbStore | sync(mode: SyncMode, predicates: RdbPredicates): Promise\<Array\<[string, number]>> | Synchronizes data between devices. This API uses a promise to return the result.<br>- **mode**: synchronization mode. **SYNC_MODE_PUSH** means to push data from the local device to a remote device. **SYNC_MODE_PULL** means to pull data from a remote device to the local device.<br>- **predicates**: specifies the data and devices to synchronize.<br>- **string**: device ID. <br>- **number**: synchronization status of that device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure.|
| RdbStore | sync(mode: SyncMode, predicates: RdbPredicates): Promise\<Array\<[string, number]>> | Synchronizes data between devices. This API uses a promise to return the result.<br>- **mode**: synchronization mode. **SYNC_MODE_PUSH** means to push data from the local device to a remote device. **SYNC_MODE_PULL** means to pull data from a remote device to the local device.<br>- **predicates**: specifies the data and devices to synchronize.<br>- **string**: device ID. <br>- **number**: synchronization status of each device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure.|
**Registering an RDB Store Observer**
......
......@@ -22,8 +22,8 @@ import stats from '@ohos.bundleState';
| function queryAppUsagePriorityGroup(callback: AsyncCallback&lt;number&gt;): void | Queries the priority group of this application. This API uses an asynchronous callback to return the result.|
| function queryAppUsagePriorityGroup(): Promise&lt;number&gt;; | Queries the priority group of this application. This API uses a promise to return the result.|
| function isIdleState(bundleName: string, callback: AsyncCallback&lt;boolean&gt;): void | Checks whether the application specified by **bundleName** is in the idle state. |
| function getRecentlyUsedModules(callback: AsyncCallback&lt;BundleActiveModuleInfo&gt;): void | Obtains the number of FA usage records specified by **1000**.|
| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback&lt;BundleActiveModuleInfo&gt;): void | Obtains the number of FA usage records specified by **maxNum**.|
| function getRecentlyUsedModules(callback: AsyncCallback&lt;BundleActiveModuleInfo&gt;): void | Obtains a maximum of 1000 FA usage records. |
| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback&lt;BundleActiveModuleInfo&gt;): void | Obtains the number of FA usage records specified by **maxNum**, which cannot exceed 1000.|
| function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback&lt;Array&lt;BundleActiveEventState&gt;&gt;): void | Queries the number of notifications from all applications based on the specified start time and end time.|
| function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback&lt;Array&lt;BundleActiveEventState&gt;&gt;): void | Queries statistics about system events (hibernation, wakeup, unlocking, and screen locking) that occur between the specified start time and end time.|
| function queryAppUsagePriorityGroup(bundleName : string, callback: AsyncCallback&lt;number&gt;): void | Queries the priority group of the application specified by **bundleName**. This API uses an asynchronous callback to return the result.|
......@@ -326,14 +326,14 @@ import stats from '@ohos.bundleState';
```js
import stats from '@ohos.bundleState'
// Promise mode without parameters
// Promise mode when bundleName is not specified
stats.queryAppUsagePriorityGroup().then(res => {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res));
}).catch(err => {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code);
});
// Asynchronous callback mode without parameters
// Asynchronous callback mode when bundleName is not specified
stats.queryAppUsagePriorityGroup((err, res) => {
if (err) {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback failed. because: ' + err.code);
......@@ -341,16 +341,16 @@ import stats from '@ohos.bundleState';
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res));
}
});
// Promise mode with parameters
stats.queryAppUsagePriorityGroup(this.bundleName).then(res => {
let bundleName = "com.ohos.camera";
// Promise mode when bundleName is specified
stats.queryAppUsagePriorityGroup(bundleName).then(res => {
console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res));
}).catch(err => {
console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code);
});
// Asynchronous callback mode with parameters
stats.queryAppUsagePriorityGroup(this.bundleName, (err, res) => {
// Asynchronous callback mode when bundleName is specified
stats.queryAppUsagePriorityGroup(bundleName, (err, res) => {
if (err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
......@@ -437,3 +437,4 @@ import stats from '@ohos.bundleState';
}
});
```
......@@ -202,7 +202,7 @@ struct DialogTest {
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9
The **\<List>** component is a scrollable container. By default, it taks up the entire screen height. When any component with a fixed height takes up part of the screen height, you need to explicitly specify **layoutWeight(1)** for the parent container of the **\<List>** component to take up the remaining height instead of the entire screen height.
The **\<List>** component is a scrollable container. By default, it takes up the entire screen height. When any component with a fixed height takes up part of the screen height, you need to explicitly specify **layoutWeight(1)** for the parent container of the **\<List>** component to take up the remaining height instead of the entire screen height.
## How do I center child components in a grid container?
......
......@@ -30,7 +30,7 @@ let options = {trim : false, declarationKey:"_declaration",
nameKey : "_name", elementsKey : "_elements"}
let result:any = conv.convert(xml, options) // Convert fields in the XML file into JavaScript objects.
console.log('Test: ' + JSON.stringify(result))
console.log('Test: ' + result._declaration._attributes.version) // vesion field in XML file
console.log('Test: ' + result._declaration._attributes.version) // version field in XML file
console.log('Test: ' + result._elements[0]._elements[0]._elements[0]._text) // title field in XML file
```
......
......@@ -21,45 +21,43 @@ let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {
// Create a PixelMap object.
const color = new ArrayBuffer(96);
let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } }
image.createPixelMap(color, opts, pixelmap => {
expect(pixelmap !== null).assertTrue();
console.info('TC_001-1 success');
done();
})
image.createPixelMap(color, opts, pixelmap => {
console.log('Succeeded in creating pixelmap.');
})
// Read pixels.
pixelmap.readPixels(area,(data) => {
if(data !== null) {
var bufferArr = new Uint8Array(area.pixels);
if(data !== null) {
var bufferArr = new Uint8Array(area.pixels);
var res = true;
for (var i = 0; i < bufferArr.length; i++) {
console.info('TC_021-1 buffer ' + bufferArr[i]);
if(res) {
if(bufferArr[i] == 0) {
res = false;
console.info('TC_021-1 Success');
expect(true).assertTrue();
done();
break;
}
}
console.info(' buffer ' + bufferArr[i]);
if(res) {
if(bufferArr[i] == 0) {
res = false;
console.log('readPixels end.');
break;
}
}
}
}
})
// Store pixels.
const readBuffer = new ArrayBuffer(96);
pixelmap.readPixelsToBuffer(readBuffer,() => {
var bufferArr = new Uint8Array(readBuffer);
var res = true;
for (var i = 0; i < bufferArr.length; i++) {
if(res) {
if (bufferArr[i] !== 0) {
res = false;
console.info('TC_020-1 Success');
expect(true).assertTrue();
done();
break;
var bufferArr = new Uint8Array(readBuffer);
var res = true;
for (var i = 0; i < bufferArr.length; i++) {
if(res) {
if (bufferArr[i] !== 0) {
res = false;
console.log('readPixelsToBuffer end.');
break;
}
}
}
}
})
// Write pixels.
pixelmap.writePixels(area,() => {
......@@ -71,56 +69,51 @@ pixelmap.writePixels(area,() => {
if(res) {
if (readArr[i] !== 0) {
res = false;
console.info('TC_022-1 Success');
expect(true).assertTrue();
done();
console.log('readPixels end.please check buffer');
break;
}
}
}
})
})
// Write pixels to the buffer.
pixelmap.writeBufferToPixels(writeColor).then(() => {
const readBuffer = new ArrayBuffer(96);
pixelmap.readPixelsToBuffer(readBuffer).then (() => {
var bufferArr = new Uint8Array(readBuffer);
var res = true;
for (var i = 0; i < bufferArr.length; i++) {
if(res) {
if (bufferArr[i] !== i) {
res = false;
console.info('TC_023 Success');
expect(true).assertTrue()
done();
var bufferArr = new Uint8Array(readBuffer);
var res = true;
for (var i = 0; i < bufferArr.length; i++) {
if(res) {
if (bufferArr[i] !== i) {
res = false;
console.log('readPixels end.please check buffer');
break;
}
}
}
})
})
// Obtain image information.
pixelmap.getImageInfo( imageInfo => {
if (imageInfo !== null) {
console.info('TC_024-1 imageInfo is ready');
expect(imageInfo.size.height == 4).assertTrue();
expect(imageInfo.size.width == 6).assertTrue();
expect(imageInfo.pixelFormat == 4).assertTrue();
done();
console.log('Succeeded in getting imageInfo');
}
})
// Release the PixelMap object.
pixelmap.release(()=>{
expect(true).assertTrue();
console.log('TC_027-1 suc');
done();
console.log('Succeeded in releasing pixelmap');
})
let path = '/data/local/tmp/test.jpg';
// Create an image source (uri).
const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.jpg'
let path = '/data/local/tmp/test.jpg';
const imageSourceApi = image.createImageSource(path);
// Create an image source (fd).
const imageSourceApi = image.createImageSource(29);
let fd = 29;
const imageSourceApi = image.createImageSource(fd);
// Create an image source (data).
const data = new ArrayBuffer(96);
......@@ -128,15 +121,15 @@ const imageSourceApi = image.createImageSource(data);
// Release the image source.
imageSourceApi.release(() => {
console.info('TC_044-1 Success');
})
console.log('Succeeded in releasing imagesource');
})
// Encode the image.
const imagePackerApi = image.createImagePacker();
const imageSourceApi = image.createImageSource(0);
let packOpts = { format:"image/jpeg", quality:98 };
imagePackerApi.packing(imageSourceApi, packOpts, data => {
console.info('TC_062-1 finished');
expect(data !== null).assertTrue();
done();
console.log('Succeeded in packing');
})
// Release the ImagePacker object.
......@@ -164,59 +157,40 @@ let decodingOptions = {
// Create a pixel map in callback mode.
imageSourceApi.createPixelMap(decodingOptions, pixelmap => {
console.info('TC_050 createPixelMap ');
expect(pixelmap !== null ).assertTrue();
done();
})
}
console.log('Succeeded in creating pixelmap.');
})
// Create a pixel map in promise mode.
imageSourceApi.createPixelMap().then(pixelmap => {
console.info('TC_050-11 createPixelMap ');
expect(pixelmap !== null ).assertTrue();
done();
console.log('Succeeded in creating pixelmap.');
})
// Capture error information when an exception occurs during function invoking.
catch(error => {
console.log('TC_050-11 error: ' + error);
expect().assertFail();
done();
console.log('Failed in creating pixelmap.' + error);
})
// Obtain the number of bytes in each line of pixels.
pixelmap.getBytesNumberPerRow( num => {
console.info('TC_025-1 num is ' + num);
expect(num == expectNum).assertTrue();
done();
console.log('Succeeded in getting BytesNumber PerRow.');
})
// Obtain the total number of pixel bytes.
pixelmap.getPixelBytesNumber(num => {
console.info('TC_026-1 num is ' + num);
expect(num == expectNum).assertTrue();
done();
console.log('Succeeded in getting PixelBytesNumber.');
})
// Obtain the pixel map information.
pixelmap.getImageInfo( imageInfo => {})
// Print the failure information.
console.info('TC_024-1 imageInfo is empty');
expect(false).assertTrue()
// Release the PixelMap object.
pixelmap.release(()=>{
expect(true).assertTrue();
console.log('TC_027-1 suc');
done();
console.log('Succeeded in releasing pixelmap');
})
// Capture release failure information.
catch(error => {
console.log('TC_027-1 error: ' + error);
expect().assertFail();
done();
console.log('Failed in releasing pixelmap.' + error);
})
```
......@@ -230,9 +204,7 @@ const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.p
// Print the error message if the image source fails to be created.
if (imageSourceApi == null) {
console.info('TC_062 create image source failed');
expect(false).assertTrue();
done();
console.log('Failed in creating imageSource.');
}
// Create an image packer if the image source is successfully created.
......@@ -240,9 +212,7 @@ const imagePackerApi = image.createImagePacker();
// Print the error information if the image packer fails to be created.
if (imagePackerApi == null) {
console.info('TC_062 create image packer failed');
expect(false).assertTrue();
done();
console.log('Failed in creating imagePacker.');
}
// Set encoding parameters if the image packer is successfully created.
......@@ -252,19 +222,15 @@ let packOpts = { format:["image/jpeg"], // The supported encoding format is jpg.
// Encode the image.
imagePackerApi.packing(imageSourceApi, packOpts)
.then( data => {
console.info('TC_062 finished');
expect(data !== null).assertTrue();
done();
console.log('Succeeded in packing');
})
// Release the image packer after the encoding is complete.
imagePackerApi.release();
// Obtain the image source information.
imageSourceApi.getImageInfo(imageInfo => {
console.info('TC_045 imageInfo');
expect(imageInfo !== null).assertTrue();
done();
console.log('Succeeded in getting imageInfo');
})
// Update incremental data.
......
......@@ -37,9 +37,7 @@ For details about the APIs, see [reminderAgent](../reference/apis/js-apis-remind
import reminderAgent from '@ohos.reminderAgent';
import notification from '@ohos.notification';
export default {
// For a JS project:
// timer: {
// For an eTS project:
// eTS project:
let timer : reminderAgent.ReminderRequestTimer = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 10,
......@@ -69,9 +67,7 @@ For details about the APIs, see [reminderAgent](../reference/apis/js-apis-remind
Sample code for defining a reminder agent for a calendar event:
```js
// For a JS project:
// calendar: {
// For an eTS project:
// eTS project:
let calendar : reminderAgent.ReminderRequestCalendar = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_CALENDAR,
dateTime: {
......@@ -117,9 +113,7 @@ For details about the APIs, see [reminderAgent](../reference/apis/js-apis-remind
Sample code for defining a reminder agent for an alarm:
```js
// For a JS project:
// alarm: {
// For an eTS project:
// eTS project:
let alarm : reminderAgent.ReminderRequestAlarm = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM,
hour: 11,
......@@ -171,4 +165,3 @@ For details about the APIs, see [reminderAgent](../reference/apis/js-apis-remind
<button type="text" value="publishReminder" onclick="startTimer"></button>
</div>
```
......@@ -13,14 +13,14 @@ Each application can subscribe to common events as required. After your applicat
## Common Event Subscription Development
### When to Use
You can create a subscriber object to subscribe to a common event to obtain the parameters passed in the event. Certain system common events require specific permissions to subscribe to. For details, see [Required Permissions](../reference/apis/js-apis-commonEvent.md).
You can create a subscriber object to subscribe to a common event to obtain the parameters passed in the event. Certain system common events require specific permissions to subscribe to. For details, see [Required Permissions](../reference/apis/js-apis-commonEvent.md#support).
### Available APIs
| API | Description|
| ---------------------------------------------------------------------------------------------- | ----------- |
| commonEvent.createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback) | Creates a subscriber. This API uses a callback to return the result.|
| commonEvent.createSubscriber(subscribeInfo: CommonEventSubscribeInfo) | Creates a subscriber. This API uses a promise to return the result. |
| commonEvent.subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback) | Subscribes to common events.|
| createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback) | Creates a subscriber. This API uses a callback to return the result.|
| createSubscriber(subscribeInfo: CommonEventSubscribeInfo) | Creates a subscriber. This API uses a promise to return the result. |
| subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback) | Subscribes to common events.|
### How to Develop
1. Import the **commonEvent** module.
......@@ -82,8 +82,8 @@ You can use the **publish** APIs to publish a custom common event, which can car
### Available APIs
| API | Description|
| ---------------------------------- | ------ |
| commonEvent.publish(event: string, callback: AsyncCallback) | Publishes a common event.|
| commonEvent.publish(event: string, options: CommonEventPublishData, callback: AsyncCallback) | Publishes a common event with given attributes.|
| publish(event: string, callback: AsyncCallback) | Publishes a common event.|
| publish(event: string, options: CommonEventPublishData, callback: AsyncCallback) | Publishes a common event with given attributes.|
### How to Develop
#### Development for Publishing a Common Event
......@@ -119,7 +119,7 @@ import commonEvent from '@ohos.commonEvent'
// Attributes of a common event.
var options = {
code: 1, // Result code of the common event
data: "initial data",// Result data of the common event
data: "initial data";// Result data of the common event
}
```
......@@ -144,7 +144,7 @@ You can use the **unsubscribe** API to unsubscribe from a common event.
### Available APIs
| API | Description|
| ---------------------------------- | ------ |
| commonEvent.unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback) | Unsubscribes from a common event.|
| unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback) | Unsubscribes from a common event.|
### How to Develop
1. Import the **commonEvent** module.
......@@ -153,7 +153,7 @@ You can use the **unsubscribe** API to unsubscribe from a common event.
import commonEvent from '@ohos.commonEvent';
```
2. Subscribe to a common event by following instructions in [Common Event Subscription Development](#Common-Event-Subscription-Development).
2. Subscribe to a common event by following instructions in [Common Event Subscription Development](#common-event-subscription-development).
3. Invoke the **unsubscribe** API in **CommonEvent** to unsubscribe from the common event.
```js
......
......@@ -7,16 +7,13 @@ Common Event Service (CES) enables applications to publish, subscribe to, and un
![ces](figures/ces.png)
- System common event: sent by the system based on system policies to the applications that have subscribed to the event. This type of event includes the screen-on/off events that the users are aware of and the system events published by key system services, such as USB device attachment or detachment, network connection, and system update events.
- Custom common event: customized by applications to be received by specific subscribers. This type of event is usually related to the service logic of the sender applications.
The Advanced Notification Service (ANS) enables applications to publish notifications. Below are some typical use cases for publishing notifications:
The Advanced Notification Service (ANS) enables applications to publish notifications. Below are some typical use cases for publishing notifications:
- Display received SMS messages and instant messages.
- Display push messages of applications, such as advertisements, version updates, and news notifications.
- Display ongoing events, such as music playback, navigation information, and download progress.
- Display received SMS messages and instant messages.
- Display push messages of applications, such as advertisements, version updates, and news notifications.
- Display ongoing events, such as music playback, navigation information, and download progress.
Notifications are displayed in the notification panel. Uses can delete a notification or click the notification to trigger predefined actions.
......
......@@ -139,6 +139,80 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => {
})
```
## bundle.getApplicationInfoSync<sup>9+</sup>
getApplicationInfoSync(bundleName: string, bundleFlags: number, userId: number): ApplicationInfo;
Obtains the application information of the specified user based on a given bundle name. This API returns the result synchronously.
**Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | Bundle name of an application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the application information flags in [BundleFlag](#bundleflag).|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
**Return value**
| Type | Description |
| ---------------------------------------------------- | ------------------- |
| [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | **ApplicationInfo** object.|
**Example**
```js
let bundleName = "com.example.myapplication";
let bundleFlags = 0;
let userId = 100;
var applicationInfo = bundle.getApplicationInfoSync(bundleName, bundleFlags, userId);
console.info('Operation successful. Name:' + applicationInfo.name);
```
## bundle.getApplicationInfoSync<sup>9+</sup>
getApplicationInfoSync(bundleName: string, bundleFlags: number) : ApplicationInfo;
Obtains the application information based on a given bundle name. This API returns the result synchronously.
**Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | Bundle name of an application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the application information flags in [BundleFlag](#bundleflag).|
**Return value**
| Type | Description |
| ---------------------------------------------------- | ------------------- |
| [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | **ApplicationInfo** object.|
**Example**
```js
let bundleName = "com.example.myapplication";
let bundleFlags = 0;
var applicationInfo = bundle.getApplicationInfoSync(bundleName, bundleFlags);
console.info('Operation successful. Name:' + applicationInfo.name);
```
## bundle.getAllBundleInfo
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array\<BundleInfo>>
......@@ -370,6 +444,82 @@ bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => {
})
```
## bundle.getBundleInfoSync<sup>9+</sup>
getBundleInfoSync(bundleName: string, bundleFlags: number, options: BundleOptions): BundleInfo;
Obtains the bundle information based on a given bundle name and bundle options. This API returns the result synchronously.
**Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------------------------------- | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | Bundle name of an application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
| options | [BundleOptions](#bundleoptions) | Yes | Options of the bundle. |
**Return value**
| Type | Description |
| ------------------------------------------ | -------------- |
| [BundleInfo](js-apis-bundle-BundleInfo.md) | **BundleInfo** object.|
**Example**
```js
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
let options = {
"userId" : 100
};
var bundleInfo = bundle.getBundleInfoSync(bundleName, bundleFlags, options);
console.info('Operation successful. Name:' + bundleInfo.name);
```
## bundle.getBundleInfoSync<sup>9+</sup>
getBundleInfoSync(bundleName: string, bundleFlags: number): BundleInfo;
Obtains the bundle information based on a given bundle name. This API returns the result synchronously.
**Required permissions**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**
SystemCapability.BundleManager.BundleFramework
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
| bundleName | string | Yes | Bundle name of an application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. For details on the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflag).|
**Return value**
| Type | Description |
| ------------------------------------------ | -------------- |
| [BundleInfo](js-apis-bundle-BundleInfo.md) | **BundleInfo** object.|
**Example**
```js
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
var bundleInfo = bundle.getBundleInfoSync(bundleName, bundleFlags);
console.info('Operation successful. Name:' + bundleInfo.name);
```
## bundle.getBundleInstaller
getBundleInstaller(): Promise&lt;BundleInstaller&gt;;
......@@ -685,7 +835,7 @@ This is a system API and cannot be called by third-party applications.
| ----------- | --------------------------- | ---- | ---------------------- |
| bundleName | string | Yes | Bundle name of an application. |
| moduleName | string | Yes | Module name of the application. |
| upgradeFlag | [UpgradeFlag](#upgradeflag) | Yes | Upgrade flag, which is for internal use only.|
| upgradeFlag | [UpgradeFlag](#upgradeflag) | Yes | Upgrade flag, which is for internal use only.|
**Return value**
......@@ -758,10 +908,10 @@ This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ---------------------------------- | ---- | ---------------------------------------------------- |
| bundleName | string | Yes | Bundle name of an application. |
| bundlePackFlag | pack.BundlePackFlag | Yes | Flags of the bundle package. |
| Name | Type | Mandatory| Description |
| -------------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------- |
| bundleName | string | Yes | Bundle name of an application. |
| bundlePackFlag | pack.BundlePackFlag | Yes | Flags of the bundle package. |
| callback | AsyncCallback<pack.BundlePackInfo> | Yes | Callback used to return the bundle package information.|
## bundle.getBundlePackInfo<sup>9+</sup>
......@@ -780,16 +930,16 @@ This is a system API and cannot be called by third-party applications.
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ------------------- | ---- | ---------------------- |
| bundleName | string | Yes | Bundle name of an application. |
| Name | Type | Mandatory| Description |
| -------------- | ------------------------------------------------- | ---- | ---------------------- |
| bundleName | string | Yes | Bundle name of an application. |
| bundlePackFlag | pack.BundlePackFlag | Yes | Flags of the bundle package.|
**Return value**
| Type | Description |
| ---------------------------- | ----------------------------------- |
| Promise<pack.BundlePackInfo> | Promise used to return the bundle package information.|
| Type | Description |
| ---------------------------- | ------------------------------------------------------ |
| Promise<pack.BundlePackInfo> | Promise used to return the bundle package information. |
## bundle.getDispatcherVersion<sup>9+</sup>
......@@ -1894,7 +2044,7 @@ SystemCapability.BundleManager.BundleFramework
| -------------- | ------ | ---- | ---------------------------------------- |
| want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. |
| extensionType | number | Yes | Type of the Extension ability information to obtain. The default value is **0**. For details on the available enumerated values, see [ExtensionAbilityType](#extensionabilitytype9).|
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#extensionflag9).|
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#extensionflag9).|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
**Return value**
......@@ -1943,7 +2093,7 @@ SystemCapability.BundleManager.BundleFramework
| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. |
| extensionType | number | Yes | Type of the Extension ability information to obtain. The default value is **0**. For details on the available enumerated values, see [ExtensionAbilityType](#extensionabilitytype9).|
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#extensionflag9).|
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#extensionflag9).|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Yes | Callback used to return the Extension ability information. |
......@@ -1986,7 +2136,7 @@ SystemCapability.BundleManager.BundleFramework
| -------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. |
| extensionType | number | Yes | Type of the Extension ability information to obtain. The default value is **0**. For details on the available enumerated values, see [ExtensionAbilityType](#extensionabilitytype9).|
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#extensionflag9).|
| extensionFlags | number | Yes | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#extensionflag9).|
| callback | AsyncCallback<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Yes | Callback used to return the Extension ability information. |
**Example**
......
......@@ -49,3 +49,51 @@ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbil
}
};
```
## EnterpriseAdminExtensionAbility.onBundleAdded
onBundleAdded(bundleName: string): void
Called when a bundle is added.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
| Parameter | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| bundleName | string | Yes | Name of the bundle added.|
**Example**
```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
onBundleAdded(bundleName: string) {
console.log("added bundle name: " + bundleName);
}
};
```
## EnterpriseAdminExtensionAbility.onBundleRemoved
onBundleRemoved(bundleName: string): void
Called when a bundle is removed.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
| Parameter | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| bundleName | string | Yes | Name of the bundle removed.|
**Example**
```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
onBundleAdded(bundleName: string) {
console.log("removed bundle name: " + bundleName);
}
};
```
# System Accessibility Configuration
The **config** module allows you to configure system accessibility features, including accessibility extension, high-contrast text, mouse buttons, and captions.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module are system APIs.
## Modules to Import
```typescript
import config from "@ohos.accessibility.config";
```
## Attributes
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| highContrastText | [Config](#config)\<boolean>| Yes| Yes| Whether to enable high-contrast text.|
| invertColor | [Config](#config)\<boolean>| Yes| Yes| Whether to enable color inversion.|
| daltonizationColorFilter | [Config](#config)&lt;[DaltonizationColorFilter](#daltonizationcolorfilter)&gt;| Yes| Yes| Configuration of the daltonization filter.|
| contentTimeout | [Config](#config)\<number>| Yes| Yes| Recommended duration for content display. The value ranges from 0 to 5000, in milliseconds.|
| animationOff | [Config](#config)\<boolean>| Yes| Yes| Whether to enable animation.|
| brightnessDiscount | [Config](#config)\<number>| Yes| Yes| Brightness discount. The value ranges from 0 to 1.0.|
| mouseKey | [Config](#config)\<boolean>| Yes| Yes| Whether to enable the mouse button feature.|
| mouseAutoClick | [Config](#config)\<number>| Yes| Yes| Interval for the automatic mouse clicks. The value ranges from 0 to 5000, in milliseconds.|
| shortkey | [Config](#config)\<boolean>| Yes| Yes| Whether to enable the accessibility extension shortcut key.|
| shortkeyTarget | [Config](#config)\<string>| Yes| Yes| Target application for the accessibility extension shortcut key. The value format is bundleName/abilityName.|
| captions | [Config](#config)\<boolean>| Yes| Yes| Whether to enable captions.|
| captionsStyle | [Config](#config)\<[accessibility.CaptionsStyle](./js-apis-accessibility.md#captionsstyle8)>| Yes| Yes| Captions style.|
## enableAbility
enableAbility(name: string, capability: Array&lt;[accessibility.Capability](./js-apis-accessibility.md#capability)&gt;): Promise&lt;void&gt;;
Enables an accessibility extension ability. This API uses a promise to return the result.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the accessibility extension ability. The format is bundleName/abilityName.|
| capability | Array&lt;[accessibility.Capability](./js-apis-accessibility.md#capability)&gt;) | Yes| Capability of the accessibility extension ability.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
**Example**
```typescript
config.enableAbility("com.ohos.example/axExtension", ['retrieve'])
.then(() => {
console.info('enable succeed');
}).catch((error) => {
console.error('enable failed');
});
```
## enableAbility
enableAbility(name: string, capability: Array&lt;[accessibility.Capability](./js-apis-accessibility.md#capability)&gt;, callback: AsyncCallback&lt;void&gt;): void;
Enables an accessibility extension ability. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the accessibility extension ability. The format is bundleName/abilityName.|
| capability | Array&lt;[accessibility.Capability](./js-apis-accessibility.md#capability)&gt; | Yes| Capability of the accessibility extension ability.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the execution result.|
**Example**
```typescript
config.enableAbility("com.ohos.example/axExtension", ['retrieve'], (err, data) => {
if (err) {
console.error('enable failed');
return;
}
console.info('enable succeed');
})
```
## disableAbility
disableAbility(name: string): Promise&lt;void&gt;;
Disables an accessibility extension ability. This API uses a promise to return the result.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the accessibility extension ability. The format is bundleName/abilityName.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
**Example**
```typescript
config.disableAbility("com.ohos.example/axExtension")
.then(() => {
console.info('disable succeed');
}).catch((error) => {
console.error('disable failed');
});
```
## disableAbility
disableAbility(name: string, callback: AsyncCallback&lt;void&gt;): void;
Disables an accessibility extension ability. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the accessibility extension ability. The format is bundleName/abilityName.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the execution result.|
**Example**
```typescript
config.disableAbility("com.ohos.example/axExtension", (err, data) => {
if (err) {
console.error('disable failed');
return;
}
console.info('disable succeed');
})
```
## on('enableAbilityListsStateChanged')
on(type: 'enableAbilityListsStateChanged', callback: Callback&lt;void&gt;): void;
Adds a listener for changes in the list of enabled accessibility extension abilities.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Listening type. The value is fixed at **'enableAbilityListsStateChanged'**, indicating that the changes in the list of enabled accessibility extension abilities.|
| callback | Callback&lt;void&gt; | Yes| Callback invoked when the list of enabled accessibility extension abilities changes.|
**Example**
```typescript
config.on('enableAbilityListsStateChanged',() => {
console.info('ax extension ability enable list changed');
});
```
## off('enableAbilityListsStateChanged')
off(type: 'enableAbilityListsStateChanged', callback?: Callback&lt;void&gt;): void;
Cancels the listener for changes in the list of enabled accessibility extension abilities.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | No| Listening type. The value is fixed at **'enableAbilityListsStateChanged'**, indicating that the changes in the list of enabled accessibility extension abilities.|
| callback | Callback&lt;void&gt; | No| Callback invoked when the list of enabled accessibility extension abilities changes.|
**Example**
```typescript
config.off('enableAbilityListsStateChanged');
```
## Config
Implements configuration, acquisition, and listening for attributes.
### set
set(value: T): Promise&lt;void&gt;;
Sets this attribute. This API uses a promise to return the result.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Attribute value to set.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the execution result.|
**Example**
```typescript
config.highContrastText.set(true)
.then(() => {
console.info('highContrastText set succeed');
}).catch((error) => {
console.error('highContrastText set failed');
});
```
### set
set(value: T, callback: AsyncCallback&lt;void&gt;): void;
Sets this attribute. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | T | Yes| Attribute value to set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the execution result.|
**Example**
```typescript
config.highContrastText.set(true, (err, data) => {
if (err) {
console.error('highContrastText set failed');
return;
}
console.info('highContrastText set succeed');
})
```
### get
get(): Promise&lt;T&gt;;
Obtains the value of this attribute. This API uses a promise to return the result.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;T&gt; | Promise used to return the attribute value.|
**Example**
```typescript
config.highContrastText.get()
.then((value) => {
console.info('highContrastText get succeed');
}).catch((error) => {
console.error('highContrastText get failed');
});
```
### get
get(callback: AsyncCallback&lt;T&gt;): void;
Obtains the value of this attribute. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the attribute value.|
**Example**
```typescript
config.highContrastText.get((err, data) => {
if (err) {
console.error('highContrastText get failed');
return;
}
console.info('highContrastText get succeed');
})
```
### on
on(callback: Callback&lt;T&gt;): void;
Adds a listener for attribute changes.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | Callback&lt;T&gt; | Yes| Callback invoked when the attribute changes.|
**Example**
```typescript
config.highContrastText.on(() => {
console.info('highContrastText changed');
});
```
### off
off(callback?: Callback&lt;T&gt;): void;
Cancels the listener for attribute changes.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | Callback&lt;T&gt; | No| Callback invoked when the attribute changes.|
**Example**
```typescript
config.highContrastText.off();
```
## DaltonizationColorFilter
Enumerates the daltonization filters.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
| Name| Description|
| -------- | -------- |
| Normal | Filter for normal users.|
| Protanomaly | Filter for protanomaly.|
| Deuteranomaly | Filter for deuteranomaly.|
| Tritanomaly | Filter for tritanomaly.|
......@@ -14,19 +14,19 @@ The mission snapshot information can be obtained by using **getMissionSnapShot**
```js
import ElementName from '@ohos.bundle';
import image from '@ohos.multimedia.image';
import missionManager from '@ohos.application.missionManager'
import missionManager from '@ohos.application.missionManager';
missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code);
console.log("size = " + missions.length);
console.log("missions = " + JSON.stringify(missions));
var id = missions[0].missionId;
missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code);
console.log("size = " + missions.length);
console.log("missions = " + JSON.stringify(missions));
var id = missions[0].missionId;
missionManager.getMissionSnapShot("", id, (error, snapshot) => {
console.log("getMissionSnapShot is called, error.code = " + error.code);
console.log("bundleName = " + snapshot.ability.bundleName);
})
missionManager.getMissionSnapShot("", id, (error, snapshot) => {
console.log("getMissionSnapShot is called, error.code = " + error.code);
console.log("bundleName = " + snapshot.ability.bundleName);
})
})
```
## MissionSnapshot
......
......@@ -16,6 +16,16 @@ import buffer from '@ohos.buffer';
## Buffer
### Attributes
**System capability**: SystemCapability.Utils.Lang
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| length | number | Yes| No| Length of the buffer, in bytes.|
| buffer | ArrayBuffer | Yes| No| **ArrayBuffer** object.|
| byteOffset | number | Yes| No| Offset of the buffer in the memory pool.|
### alloc
alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer
......@@ -2422,7 +2432,7 @@ Creates a **Blob** instance by copying specified data from this **Blob** instanc
let blob3 = blob.slice(0, 2, "MIME");
```
### text
### text
text(): Promise&lt;string&gt;
......
......@@ -195,7 +195,7 @@ Moves to the specified row in the result set.
**Example**
```ts
let goToRowNum = 2
let goToRowNum = 2;
let isGoToRow = resultSet.goToRow(goToRowNum);
console.info('resultSet.goToRow: ' + isGoToRow);
```
......@@ -223,7 +223,7 @@ Obtains the value in the form of a byte array based on the specified column and
**Example**
```ts
let columnIndex = 1
let columnIndex = 1;
let goToFirstRow = resultSet.goToFirstRow();
let getBlob = resultSet.getBlob(columnIndex);
console.info('resultSet.getBlob: ' + getBlob);
......@@ -231,7 +231,7 @@ console.info('resultSet.getBlob: ' + getBlob);
### getString
getString(columnIndex: number): *string*
getString(columnIndex: number): string
Obtains the value in the form of a string based on the specified column and the current row.
......@@ -252,7 +252,7 @@ Obtains the value in the form of a string based on the specified column and the
**Example**
```ts
let columnIndex = 1
let columnIndex = 1;
let goToFirstRow = resultSet.goToFirstRow();
let getString = resultSet.getString(columnIndex);
console.info('resultSet.getString: ' + getString);
......@@ -281,7 +281,7 @@ Obtains the value in the form of a long integer based on the specified column an
**Example**
```ts
let columnIndex = 1
let columnIndex = 1;
let goToFirstRow = resultSet.goToFirstRow();
let getLong = resultSet.getLong(columnIndex);
console.info('resultSet.getLong: ' + getLong);
......@@ -310,7 +310,7 @@ Obtains the value in the form of a double-precision floating-point number based
**Example**
```ts
let columnIndex = 1
let columnIndex = 1;
let goToFirstRow = resultSet.goToFirstRow();
let getDouble = resultSet.getDouble(columnIndex);
console.info('resultSet.getDouble: ' + getDouble);
......@@ -353,14 +353,14 @@ Obtains the column index based on the column name.
**Example**
```ts
let ColumnName = "name"
let getColumnIndex = resultSet.getColumnIndex(ColumnName)
let ColumnName = "name";
let getColumnIndex = resultSet.getColumnIndex(ColumnName);
console.info('resultSet.getColumnIndex: ' + getColumnIndex);
```
### getColumnName
getColumnName(columnIndex: number): *string*
getColumnName(columnIndex: number): string
Obtains the column name based on the column index.
......@@ -381,8 +381,8 @@ Obtains the column name based on the column index.
**Example**
```ts
let columnIndex = 1
let getColumnName = resultSet.getColumnName(columnIndex)
let columnIndex = 1;
let getColumnName = resultSet.getColumnName(columnIndex);
console.info('resultSet.getColumnName: ' + getColumnName);
```
......
......@@ -2,6 +2,8 @@
You can use **DataSharePredicates** to specify conditions for [updating](js-apis-data-dataShare.md#update), [deleting](js-apis-data-dataShare.md#delete), and [querying](js-apis-data-dataShare.md#query) data when **DataShare** is used to manage data.
The APIs provided by **DataSharePredicates** correspond to the filter criteria of the database. Before using the APIs, you need to have basic database knowledge.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -22,7 +24,7 @@ Provides methods for setting different **DataSharePredicates** objects.
equalTo(field: string, value: ValueType): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is equal to the specified value.
Sets a **DataSharePredicates** object to search for the data that is equal to the specified value.
Currently, only the relational database (RDB) and key-value database (KVDB, schema) support this **DataSharePredicates** object.
......@@ -52,7 +54,7 @@ predicates.equalTo("NAME", "Rose")
notEqualTo(field: string, value: ValueType): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is not equal to the specified value.
Sets a **DataSharePredicates** object to search for the data that is not equal to the specified value.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -188,7 +190,7 @@ predicates.equalTo("NAME", "lisi")
contains(field: string, value: string): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that contains the specified value.
Sets a **DataSharePredicates** object to search for the data that contains the specified value.
Currently, only the RDB supports this **DataSharePredicates** object.
......@@ -218,7 +220,7 @@ predicates.contains("NAME", "os")
beginsWith(field: string, value: string): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that begins with the specified value.
Sets a **DataSharePredicates** object to search for the data that begins with the specified value.
Currently, only the RDB supports this **DataSharePredicates** object.
......@@ -248,7 +250,7 @@ predicates.beginsWith("NAME", "os")
endsWith(field: string, value: string): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that ends with the specified value.
Sets a **DataSharePredicates** object to search for the data that ends with the specified value.
Currently, only the RDB supports this **DataSharePredicates** object.
......@@ -278,7 +280,7 @@ predicates.endsWith("NAME", "os")
isNull(field: string): DataSharePredicates
Sets a **DataSharePredicates** object to match the data whose value is null.
Sets a **DataSharePredicates** object to search for the data whose value is null.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -307,7 +309,7 @@ predicates.isNull("NAME")
isNotNull(field: string): DataSharePredicates
Sets a **DataSharePredicates** object to match the data whose value is not null.
Sets a **DataSharePredicates** object to search for the data whose value is not null.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -336,7 +338,7 @@ predicates.isNotNull("NAME")
like(field: string, value: string): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is similar to the specified value.
Sets a **DataSharePredicates** object to search for the data that matches the specified wildcard expression.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -347,7 +349,7 @@ Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** o
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------- |
| field | string | Yes | Column name in the database table. |
| value | string | Yes | Value to match.|
| value | string | Yes | Wildcard expression to match.<br>In the expression, '%' represents zero, one, or more digits or characters, and '_' represents a single digit or character. It is case insensitive.|
**Return value**
......@@ -366,7 +368,7 @@ predicates.like("NAME", "%os%")
unlike(field: string, value: string): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is not not similar to the specified value.
Sets a **DataSharePredicates** object to search for the data that does not match the specified wildcard expression.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -377,7 +379,7 @@ Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** o
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------- |
| field | string | Yes | Column name in the database table. |
| value | string | Yes | Value to match.|
| value | string | Yes | Wildcard expression to match.<br>In the expression, '%' represents zero, one, or more digits or characters, and '_' represents a single digit or character. It is case insensitive.|
**Return value**
......@@ -396,7 +398,7 @@ predicates.unlike("NAME", "%os%")
glob(field: string, value: string): DataSharePredicates
Sets a **DataSharePredicates** object to match the specified string.
Sets a **DataSharePredicates** object to search for the data that matches the specified wildcard expression.
Currently, only the RDB supports this **DataSharePredicates** object.
......@@ -407,7 +409,7 @@ Currently, only the RDB supports this **DataSharePredicates** object.
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------- |
| field | string | Yes | Column name in the database table. |
| value | string | Yes | Value to match.|
| value | string | Yes | Wildcard expression to match.<br>In the expression, '*' represents zero, one, or more digits or characters, and '?' represents a single digit or character. It is case sensitive.|
**Return value**
......@@ -426,7 +428,7 @@ predicates.glob("NAME", "?h*g")
between(field: string, low: ValueType, high: ValueType): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is within the specified range.
Sets a **DataSharePredicates** object to search for the data that is within the specified range, including the start and end values.
Currently, only the RDB supports this **DataSharePredicates** object.
......@@ -457,7 +459,7 @@ predicates.between("AGE", 10, 50)
notBetween(field: string, low: ValueType, high: ValueType): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is out of the specified range.
Sets a **DataSharePredicates** object to search for the data that is out of the specified range, excluding the start and end values.
Currently, only the RDB supports this **DataSharePredicates** object.
......@@ -488,7 +490,7 @@ predicates.notBetween("AGE", 10, 50)
greaterThan(field: string, value: ValueType): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is greater than the specified value.
Sets a **DataSharePredicates** object to search for the data that is greater than the specified value.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -518,7 +520,7 @@ predicates.greaterThan("AGE", 10)
lessThan(field: string, value: ValueType): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is less than the specified value.
Sets a **DataSharePredicates** object to search for the data that is less than the specified value.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -548,7 +550,7 @@ predicates.lessThan("AGE", 50)
greaterThanOrEqualTo(field: string, value: ValueType): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is greater than or equal to the specified value.
Sets a **DataSharePredicates** object to search for the data that is greater than or equal to the specified value.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -578,7 +580,7 @@ predicates.greaterThanOrEqualTo("AGE", 10)
lessThanOrEqualTo(field: string, value: ValueType): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is less than or equal to the specified value.
Sets a **DataSharePredicates** object to search for the data that is less than or equal to the specified value.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -777,7 +779,7 @@ predicates.indexedBy("SALARY_INDEX")
in(field: string, value: Array&lt;ValueType&gt;): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is within the specified value.
Sets a **DataSharePredicates** object to search for the data that is within the specified value.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -807,7 +809,7 @@ predicates.in("AGE", [18, 20])
notIn(field: string, value: Array&lt;ValueType&gt;): DataSharePredicates
Sets a **DataSharePredicates** object to match the data that is not in the specified value.
Sets a **DataSharePredicates** object to search for the data that is not in the specified value.
Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
......@@ -837,7 +839,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"])
prefixKey(prefix: string): DataSharePredicates
Sets a **DataSharePredicates** object to match the data with the specified key prefix.
Sets a **DataSharePredicates** object to search for the data with the specified key prefix.
Currently, only the KVDB supports this **DataSharePredicates** object.
......@@ -866,7 +868,7 @@ predicates.prefixKey("NAME")
inKeys(keys: Array&lt;string&gt;): DataSharePredicates
Sets a **DataSharePredicates** object to match the data whose keys are within the given range.
Sets a **DataSharePredicates** object to search for the data whose keys are within the given range.
Currently, only the KVDB supports this **DataSharePredicates** object.
......
......@@ -24,7 +24,7 @@ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
## DeviceSettingsManager.setDateTime
setDateTime(admin: Want, time: number, callback: AsyncCallback<void>): void
setDateTime(admin: Want, time: number, callback: AsyncCallback\<void>): void
Sets the system time. This API uses an asynchronous callback to return the result.
......@@ -38,7 +38,7 @@ Sets the system time. This API uses an asynchronous callback to return the resul
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application.|
| time | number | Yes| Timestamp (ms).|
| callback | AsyncCallback<void> | Yes| Callback used to the result. If the system time is set successfully, **err** is **null**; otherwise, **err** is an error object.|
| callback | AsyncCallback\<void> | Yes| Callback used to the result. If the system time is set successfully, **err** is **null**; otherwise, **err** is an error object.|
**Example**
......@@ -64,7 +64,7 @@ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
## DeviceSettingsManager.setDateTime
setDateTime(admin: Want, time: number): Promise<void>
setDateTime(admin: Want, time: number): Promise\<void>
Sets the system time. This API uses a promise to return the result.
......@@ -83,8 +83,7 @@ Sets the system time. This API uses a promise to return the result.
| Type | Description |
| ----- | ----------------------------------- |
| Promise<void> | Promise that returns no value.|
| Promise\<void> | Promise that returns no value.|
**Example**
......
......@@ -30,9 +30,10 @@ This API is defined but not implemented in OpenHarmony 3.1 Release.
**Example**
```js
let nativeHeapSize = hidebug.getNativeHeapSize();
```
```js
let nativeHeapSize = hidebug.getNativeHeapSize();
```
## hidebug.getNativeHeapAllocatedSize
......@@ -45,17 +46,18 @@ This API is defined but not implemented in OpenHarmony 3.1 Release.
**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug
**Return value**
| Type | Description |
| ------ | --------------------------------- |
| bigint | Size of the allocated native heap memory, in kB.|
**Example**
```js
let nativeHeapAllocatedSize = hidebug.getNativeHeapAllocatedSize();
```
```js
let nativeHeapAllocatedSize = hidebug.getNativeHeapAllocatedSize();
```
## hidebug.getNativeHeapFreeSize
......@@ -68,17 +70,18 @@ This API is defined but not implemented in OpenHarmony 3.1 Release.
**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug
**Return value**
| Type | Description |
| ------ | ------------------------------- |
| bigint | Size of the free native heap memory, in kB.|
**Example**
```js
let nativeHeapFreeSize = hidebug.getNativeHeapFreeSize();
```
```js
let nativeHeapFreeSize = hidebug.getNativeHeapFreeSize();
```
## hidebug.getPss
......@@ -89,17 +92,18 @@ Obtains the PSS of this process.
**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug
**Return value**
| Type | Description |
| ------ | ------------------------- |
| bigint | PSS of the process, in kB.|
**Example**
```js
let pss = hidebug.getPss();
```
```js
let pss = hidebug.getPss();
```
## hidebug.getSharedDirty
......@@ -110,17 +114,18 @@ Obtains the size of the shared dirty memory of this process.
**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug
**Return value**
| Type | Description |
| ------ | -------------------------- |
| bigint | Size of the shared dirty memory of the process, in kB.|
**Example**
```js
let sharedDirty = hidebug.getSharedDirty();
```
```js
let sharedDirty = hidebug.getSharedDirty();
```
## hidebug.getPrivateDirty<sup>9+<sup>
......@@ -130,8 +135,8 @@ Obtains the size of the private dirty memory of this process.
**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug
**Return value**
| Type | Description |
| ------ | -------------------------- |
| bigint | Size of the private dirty memory of the process, in kB.|
......@@ -152,17 +157,18 @@ For example, if the CPU usage is **50%**, **0.5** is returned.
**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug
**Return value**
| Type | Description |
| ------ | -------------------------- |
| number | CPU usage of the process.|
**Example**
```js
let cpuUsage = hidebug.getCpuUsage();
```
```js
let cpuUsage = hidebug.getCpuUsage();
```
## hidebug.startProfiling
......@@ -189,7 +195,6 @@ hidebug.stopProfiling();
```
## hidebug.stopProfiling
stopProfiling() : void
......@@ -245,6 +250,7 @@ This is a system API and cannot be called by third-party applications.
| serviceid | number | Yes | ID of the system service. |
**Return value**
| Type | Description |
| ------ | -------------------------- |
| string | Absolute path of the file that contains the service information to dump. |
......
......@@ -27,7 +27,7 @@ Obtains an image from the specified source for subsequent rendering and display.
| Name| Type | Mandatory| Description |
| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| src | string\| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Yes | Image source. Both local and online images are supported.<br>When using an image referenced using a relative path, for example, `Image("common/test.jpg")`, the **\<Image>** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.<br>- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.<br>\- Base64 strings are supported. \ The value format is `data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, where `[base64 data]` is a Base64 string.<br/>\- The value can also be a path starting with `dataability://`, which is used to access the image path provided by a Data ability.|
| src | string\| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Yes | Image source. Both local and online images are supported.<br>When using an image referenced using a relative path, for example, `Image("common/test.jpg")`, the **\<Image>** component cannot be called across bundles or modules. Therefore, you are advised to use `$r` to reference image resources that need to be used globally.<br>- The following image formats are supported: PNG, JPG, BMP, SVG, GIF.<br>\- Base64 strings are supported. The value format is `data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, where `[base64 data]` is a Base64 string.<br/>\- The value can also be a path starting with `dataability://`, which is used to access the image path provided by a Data ability. |
## Attributes
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册