提交 53ffa66e 编写于 作者: J jidong 提交者: Gitee

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

Signed-off-by: Njidong <jidong4@huawei.com>
...@@ -164,6 +164,24 @@ zh-cn/application-dev/reference/arkui-js/ @HelloCrease ...@@ -164,6 +164,24 @@ zh-cn/application-dev/reference/arkui-js/ @HelloCrease
zh-cn/application-dev/reference/arkui-ts/ @HelloCrease zh-cn/application-dev/reference/arkui-ts/ @HelloCrease
zh-cn/application-dev/reference/native-apis @RayShih zh-cn/application-dev/reference/native-apis @RayShih
zh-cn/application-dev/reference/native-lib @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/application-test/ @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-DataUriUtils.md @RayShih 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-errorCode.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md @RayShih zh-cn/application-dev/reference/apis/js-apis-ability-wantConstant.md @RayShih
...@@ -186,7 +204,6 @@ zh-cn/application-dev/reference/apis/js-apis-particleAbility.md @RayShih ...@@ -186,7 +204,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-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-StartOptions.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.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-application-Want.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-wantAgent.md @RayShih zh-cn/application-dev/reference/apis/js-apis-wantAgent.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md @RayShih zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md @RayShih
...@@ -209,7 +226,7 @@ zh-cn/application-dev/reference/apis/js-apis-application-shellCmdResult.md @RayS ...@@ -209,7 +226,7 @@ zh-cn/application-dev/reference/apis/js-apis-application-shellCmdResult.md @RayS
zh-cn/application-dev/reference/apis/js-apis-commonEvent.md @RayShih zh-cn/application-dev/reference/apis/js-apis-commonEvent.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-emitter.md @RayShih zh-cn/application-dev/reference/apis/js-apis-emitter.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-notification.md @RayShih zh-cn/application-dev/reference/apis/js-apis-notification.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md @RayShih zh-cn/application-dev/reference/apis/js-apis-reminderAgent.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-eventhub.md @RayShih zh-cn/application-dev/reference/apis/js-apis-eventhub.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-Bundle.md @RayShih zh-cn/application-dev/reference/apis/js-apis-Bundle.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @RayShih zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @RayShih
...@@ -277,15 +294,15 @@ zh-cn/application-dev/reference/apis/js-apis-http.md @zengyawen ...@@ -277,15 +294,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-request.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-socket.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-webSocket.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-nfcTag.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-nfcTag.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-nfcTech.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-nfcTech.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-tagSession.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-tagSession.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-connectedTag.md @zengyawen 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-rpc.md @qinxiaowang
zh-cn/application-dev/reference/apis/js-apis-wifi.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-wifi.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-wifiext.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-wifiext.md @RayShih
zh-cn/application-dev/reference/apis/js-apis-accessibility.md @qinxiaowang 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-faultLogger.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hiappevent.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-hiappevent.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hichecker.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-hichecker.md @zengyawen
...@@ -293,31 +310,31 @@ zh-cn/application-dev/reference/apis/js-apis-hidebug.md @zengyawen ...@@ -293,31 +310,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-hilog.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-hitracechain.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-hitracemeter.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md @zengyawen 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-pasteboard.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-screen-lock.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 @zengyawen zh-cn/application-dev/reference/apis/js-apis-system-time.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @zengyawen 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-timer.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-battery-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 @qinxiaowang zh-cn/application-dev/reference/apis/js-apis-brightness.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-device-info.md @qinxiaowang 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-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-inputconsumer.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-inputdevice.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-inputeventclient.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-inputmonitor.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-power.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-runninglock.md @qinxiaowang 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-sensor.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-system-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-system-parameter.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-thermal.md @qinxiaowang 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-update.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-usb.md @ge-yafang 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-vibrator.md @HelloCrease
zh-cn/application-dev/reference/apis/js-apis-appAccount.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-appAccount.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-distributed-account.md @zengyawen zh-cn/application-dev/reference/apis/js-apis-distributed-account.md @zengyawen
...@@ -349,24 +366,84 @@ zh-cn/application-dev/reference/apis/js-apis-hisysevent.md @zengyawen ...@@ -349,24 +366,84 @@ 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-privacyManager.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md @HelloCrease 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/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-useriam-faceauth.md @zengyawen
zh-cn/application-dev/reference/apis/js-apis-userfilemanager.md @qinxiaowang 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-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/reference/apis/Readme-CN.md @zengyawen
zh-cn/application-dev/file-management/ @qinxiaowang zh-cn/application-dev/reference/apis/development-intro.md @zengyawen
\ No newline at end of file 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
zh-cn/application-dev/reference/apis/js-apis-reminderAgentManager.md @HelloCrease
...@@ -56,7 +56,7 @@ The methods are used to set the display orientation of the current ability. ...@@ -56,7 +56,7 @@ The methods are used to set the display orientation of the current ability.
**Example** **Example**
```javascript ```javascript
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
import bundle from '../@ohos.bundle'; import bundle from '@ohos.bundle';
export default { export default {
onCreate() { onCreate() {
...@@ -79,7 +79,7 @@ The following describes the contexts provided by the stage model in detail. ...@@ -79,7 +79,7 @@ The following describes the contexts provided by the stage model in detail.
### application/Context ### 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** **d.ts statement**
......
...@@ -12,8 +12,8 @@ An ability can be launched in the **standard**, **singleton**, or **specified** ...@@ -12,8 +12,8 @@ An ability can be launched in the **standard**, **singleton**, or **specified**
| Launch Type | Description |Action | | Launch Type | Description |Action |
| ----------- | ------- |---------------- | | ----------- | ------- |---------------- |
| standard | Multi-instance | A new instance is started each time an ability starts.| | standard | Standard mode. | 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.| | 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.| | 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: 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. ...@@ -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. 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 ```ts
let DB_NAME = "DB00.db"; const DB_NAME = "DB00.db";
let TBL_NAME = "TBL00"; const TBL_NAME = "TBL00";
let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS " const DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
+ TBL_NAME + TBL_NAME
+ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, isStudent BOOLEAN, Binary BINARY)"; + " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, isStudent BOOLEAN, Binary BINARY)";
...@@ -132,9 +132,9 @@ Examples are given below. ...@@ -132,9 +132,9 @@ Examples are given below.
1. Import the dependencies. 1. Import the dependencies.
```ts ```ts
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability';
import dataShare from '@ohos.data.dataShare' import dataShare from '@ohos.data.dataShare';
import dataSharePredicates from '@ohos.data.dataSharePredicates' import dataSharePredicates from '@ohos.data.dataSharePredicates';
``` ```
2. Define the URI string for communicating with the data provider. 2. Define the URI string for communicating with the data provider.
...@@ -164,29 +164,25 @@ Examples are given below. ...@@ -164,29 +164,25 @@ Examples are given below.
```ts ```ts
// Construct a piece of data. // Construct a piece of data.
var valuesBucket = { "name": "ZhangSan", "age": 21, "isStudent": false, "Binary": new Uint8Array([1, 2, 3]) }; let 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 updateBucket = { "name": "LiSi", "age": 18, "isStudent": true, "Binary": new Uint8Array([1, 2, 3]) };
let da = new dataSharePredicates.DataSharePredicates(); let predicates = new dataSharePredicates.DataSharePredicates();
var valArray = new Array("*"); let 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 });
// Insert a piece of data. // Insert a piece of data.
dsHelper.insert(dseUri, valuesBucket, (err, data) => { dsHelper.insert(dseUri, valuesBucket, (err, data) => {
console.log("dsHelper insert result: " + data); console.log("dsHelper insert result: " + data);
}); });
// Delete data.
dsHelper.delete(dseUri, da, (err, data) => {
console.log("dsHelper delete result: " + data);
});
// Update data. // Update data.
dsHelper.update(dseUri, da, updateBucket, (err, data) => { dsHelper.update(dseUri, predicates, updateBucket, (err, data) => {
console.log("dsHelper update result: " + data); console.log("dsHelper update result: " + data);
}); });
// Query data. // Query data.
dsHelper.query(dseUri, da, valArray, (err, data) => { dsHelper.query(dseUri, predicates, valArray, (err, data) => {
console.log("dsHelper query result: " + 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: ...@@ -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. 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. 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 ...@@ -12,7 +12,7 @@ The distributed data object management framework provides object-oriented in-mem
- **Distributed data object** - **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: 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. ...@@ -88,15 +88,22 @@ Use the following APIs to delete a **Preferences** instance or data file.
2. Obtain a **Preferences** instance. 2. Obtain a **Preferences** instance.
Read the specified file and load its data to the **Preferences** instance for data operations. Read the specified file and load its data to the **Preferences** instance for data operations.
FA model: FA model:
```js ```js
// Obtain the context. // Obtain the context.
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext() let context = featureAbility.getContext();
let preferences = null;
let promise = data_preferences.getPreferences(context, 'mystore'); let promise = data_preferences.getPreferences(context, 'mystore');
promise.then((pref) => {
preferences = pref;
}).catch((err) => {
console.info("Failed to get the preferences.");
})
``` ```
Stage model: Stage model:
...@@ -104,14 +111,21 @@ Use the following APIs to delete a **Preferences** instance or data file. ...@@ -104,14 +111,21 @@ Use the following APIs to delete a **Preferences** instance or data file.
```ts ```ts
// Obtain the context. // Obtain the context.
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
var context let context = null;
class MainAbility extends Ability{ let preferences = null;
export default class MainAbility extends Ability {
onWindowStageCreate(windowStage){ onWindowStageCreate(windowStage){
context = this.context context = this.context;
} }
} }
let promise = data_preferences.getPreferences(context, 'mystore'); let promise = data_preferences.getPreferences(context, 'mystore');
promise.then((pref) => {
preferences = pref;
}).catch((err) => {
console.info("Failed to get the preferences.");
})
``` ```
3. Write data. 3. Write data.
...@@ -119,35 +133,27 @@ Use the following APIs to delete a **Preferences** instance or data file. ...@@ -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. Use the **preferences.put()** method to write data to the **Preferences** instance.
```js ```js
promise.then((preferences) => { let putPromise = preferences.put('startup', 'auto');
let putPromise = preferences.put('startup', 'auto'); putPromise.then(() => {
putPromise.then(() => { console.info("Put the value of 'startup' successfully.");
console.info("Put the value of 'startup' successfully.");
}).catch((err) => {
console.info("Failed to put the value of 'startup'. Cause: " + err);
})
}).catch((err) => { }).catch((err) => {
console.info("Failed to get the preferences."); console.info("Failed to put the value of 'startup'. Cause: " + err);
}) })
``` ```
4. Read data. 4. Read data.
Use the **preferences.get()** method to read data. Use the **preferences.get()** method to read data.
```js ```js
promise.then((preferences) => { let getPromise = preferences.get('startup', 'default');
let getPromise = preferences.get('startup', 'default'); getPromise.then((value) => {
getPromise.then((value) => {
console.info("The value of 'startup' is " + value); console.info("The value of 'startup' is " + value);
}).catch((err) => {
console.info("Failed to get the value of 'startup'. Cause: " + err);
})
}).catch((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. 5. Store data persistently.
Use the **flush()** method to flush data from the **Preferences** instance to its file. 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. ...@@ -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. 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 ```js
var observer = function (key) { let observer = function (key) {
console.info("The key" + key + " changed."); console.info("The key" + key + " changed.");
} }
preferences.on('change', observer); 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) { if (err) {
console.info("Failed to put the value of 'startup'. Cause: " + err); console.info("Failed to put the value of 'startup'. Cause: " + err);
return; return;
......
...@@ -140,7 +140,7 @@ You can obtain the distributed table name for a remote device based on the local ...@@ -140,7 +140,7 @@ You can obtain the distributed table name for a remote device based on the local
| Class | API | Description | | 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** **Registering an RDB Store Observer**
......
...@@ -22,8 +22,8 @@ import stats from '@ohos.bundleState'; ...@@ -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(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 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 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(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**.| | 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 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 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.| | 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'; ...@@ -326,14 +326,14 @@ import stats from '@ohos.bundleState';
```js ```js
import stats from '@ohos.bundleState' import stats from '@ohos.bundleState'
// Promise mode without parameters // Promise mode when bundleName is not specified
stats.queryAppUsagePriorityGroup().then(res => { stats.queryAppUsagePriorityGroup().then(res => {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res)); console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res));
}).catch(err => { }).catch(err => {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code); 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) => { stats.queryAppUsagePriorityGroup((err, res) => {
if (err) { if (err) {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback failed. because: ' + err.code); console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback failed. because: ' + err.code);
...@@ -341,16 +341,16 @@ import stats from '@ohos.bundleState'; ...@@ -341,16 +341,16 @@ import stats from '@ohos.bundleState';
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res)); console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res));
} }
}); });
let bundleName = "com.ohos.camera";
// Promise mode with parameters // Promise mode when bundleName is specified
stats.queryAppUsagePriorityGroup(this.bundleName).then(res => { stats.queryAppUsagePriorityGroup(bundleName).then(res => {
console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res)); console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res));
}).catch(err => { }).catch(err => {
console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code); console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code);
}); });
// Asynchronous callback mode with parameters // Asynchronous callback mode when bundleName is specified
stats.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { stats.queryAppUsagePriorityGroup(bundleName, (err, res) => {
if (err) { if (err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code); console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else { } else {
...@@ -437,3 +437,4 @@ import stats from '@ohos.bundleState'; ...@@ -437,3 +437,4 @@ import stats from '@ohos.bundleState';
} }
}); });
``` ```
...@@ -202,7 +202,7 @@ struct DialogTest { ...@@ -202,7 +202,7 @@ struct DialogTest {
Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 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? ## How do I center child components in a grid container?
......
...@@ -30,7 +30,7 @@ let options = {trim : false, declarationKey:"_declaration", ...@@ -30,7 +30,7 @@ let options = {trim : false, declarationKey:"_declaration",
nameKey : "_name", elementsKey : "_elements"} nameKey : "_name", elementsKey : "_elements"}
let result:any = conv.convert(xml, options) // Convert fields in the XML file into JavaScript objects. 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: ' + 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 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: { ...@@ -21,45 +21,43 @@ let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {
// Create a PixelMap object. // Create a PixelMap object.
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96);
let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } } let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } }
image.createPixelMap(color, opts, pixelmap => { image.createPixelMap(color, opts, pixelmap => {
expect(pixelmap !== null).assertTrue(); console.log('Succeeded in creating pixelmap.');
console.info('TC_001-1 success'); })
done();
})
// Read pixels. // Read pixels.
pixelmap.readPixels(area,(data) => { pixelmap.readPixels(area,(data) => {
if(data !== null) { if(data !== null) {
var bufferArr = new Uint8Array(area.pixels); var bufferArr = new Uint8Array(area.pixels);
var res = true; var res = true;
for (var i = 0; i < bufferArr.length; i++) { for (var i = 0; i < bufferArr.length; i++) {
console.info('TC_021-1 buffer ' + bufferArr[i]); console.info(' buffer ' + bufferArr[i]);
if(res) { if(res) {
if(bufferArr[i] == 0) { if(bufferArr[i] == 0) {
res = false; res = false;
console.info('TC_021-1 Success'); console.log('readPixels end.');
expect(true).assertTrue(); break;
done();
break;
}
}
} }
}
}
}
})
// Store pixels. // Store pixels.
const readBuffer = new ArrayBuffer(96); const readBuffer = new ArrayBuffer(96);
pixelmap.readPixelsToBuffer(readBuffer,() => { pixelmap.readPixelsToBuffer(readBuffer,() => {
var bufferArr = new Uint8Array(readBuffer); var bufferArr = new Uint8Array(readBuffer);
var res = true; var res = true;
for (var i = 0; i < bufferArr.length; i++) { for (var i = 0; i < bufferArr.length; i++) {
if(res) { if(res) {
if (bufferArr[i] !== 0) { if (bufferArr[i] !== 0) {
res = false; res = false;
console.info('TC_020-1 Success'); console.log('readPixelsToBuffer end.');
expect(true).assertTrue(); break;
done(); }
break;
} }
} }
} })
// Write pixels. // Write pixels.
pixelmap.writePixels(area,() => { pixelmap.writePixels(area,() => {
...@@ -71,56 +69,51 @@ pixelmap.writePixels(area,() => { ...@@ -71,56 +69,51 @@ pixelmap.writePixels(area,() => {
if(res) { if(res) {
if (readArr[i] !== 0) { if (readArr[i] !== 0) {
res = false; res = false;
console.info('TC_022-1 Success'); console.log('readPixels end.please check buffer');
expect(true).assertTrue();
done();
break; break;
} }
} }
} }
})
})
// Write pixels to the buffer. // Write pixels to the buffer.
pixelmap.writeBufferToPixels(writeColor).then(() => { pixelmap.writeBufferToPixels(writeColor).then(() => {
const readBuffer = new ArrayBuffer(96); const readBuffer = new ArrayBuffer(96);
pixelmap.readPixelsToBuffer(readBuffer).then (() => { pixelmap.readPixelsToBuffer(readBuffer).then (() => {
var bufferArr = new Uint8Array(readBuffer); var bufferArr = new Uint8Array(readBuffer);
var res = true; var res = true;
for (var i = 0; i < bufferArr.length; i++) { for (var i = 0; i < bufferArr.length; i++) {
if(res) { if(res) {
if (bufferArr[i] !== i) { if (bufferArr[i] !== i) {
res = false; res = false;
console.info('TC_023 Success'); console.log('readPixels end.please check buffer');
expect(true).assertTrue()
done();
break; break;
} }
} }
} }
})
})
// Obtain image information. // Obtain image information.
pixelmap.getImageInfo( imageInfo => { pixelmap.getImageInfo( imageInfo => {
if (imageInfo !== null) { if (imageInfo !== null) {
console.info('TC_024-1 imageInfo is ready'); console.log('Succeeded in getting imageInfo');
expect(imageInfo.size.height == 4).assertTrue();
expect(imageInfo.size.width == 6).assertTrue();
expect(imageInfo.pixelFormat == 4).assertTrue();
done();
} }
}) })
// Release the PixelMap object. // Release the PixelMap object.
pixelmap.release(()=>{ pixelmap.release(()=>{
expect(true).assertTrue(); console.log('Succeeded in releasing pixelmap');
console.log('TC_027-1 suc');
done();
}) })
let path = '/data/local/tmp/test.jpg';
// Create an image source (uri). // 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). // Create an image source (fd).
const imageSourceApi = image.createImageSource(29); let fd = 29;
const imageSourceApi = image.createImageSource(fd);
// Create an image source (data). // Create an image source (data).
const data = new ArrayBuffer(96); const data = new ArrayBuffer(96);
...@@ -128,15 +121,15 @@ const imageSourceApi = image.createImageSource(data); ...@@ -128,15 +121,15 @@ const imageSourceApi = image.createImageSource(data);
// Release the image source. // Release the image source.
imageSourceApi.release(() => { imageSourceApi.release(() => {
console.info('TC_044-1 Success'); console.log('Succeeded in releasing imagesource');
}) })
// Encode the image. // Encode the image.
const imagePackerApi = image.createImagePacker(); const imagePackerApi = image.createImagePacker();
const imageSourceApi = image.createImageSource(0);
let packOpts = { format:"image/jpeg", quality:98 };
imagePackerApi.packing(imageSourceApi, packOpts, data => { imagePackerApi.packing(imageSourceApi, packOpts, data => {
console.info('TC_062-1 finished'); console.log('Succeeded in packing');
expect(data !== null).assertTrue();
done();
}) })
// Release the ImagePacker object. // Release the ImagePacker object.
...@@ -164,59 +157,40 @@ let decodingOptions = { ...@@ -164,59 +157,40 @@ let decodingOptions = {
// Create a pixel map in callback mode. // Create a pixel map in callback mode.
imageSourceApi.createPixelMap(decodingOptions, pixelmap => { imageSourceApi.createPixelMap(decodingOptions, pixelmap => {
console.info('TC_050 createPixelMap '); console.log('Succeeded in creating pixelmap.');
expect(pixelmap !== null ).assertTrue(); })
done();
})
}
// Create a pixel map in promise mode. // Create a pixel map in promise mode.
imageSourceApi.createPixelMap().then(pixelmap => { imageSourceApi.createPixelMap().then(pixelmap => {
console.info('TC_050-11 createPixelMap '); console.log('Succeeded in creating pixelmap.');
expect(pixelmap !== null ).assertTrue();
done();
}) })
// Capture error information when an exception occurs during function invoking. // Capture error information when an exception occurs during function invoking.
catch(error => { catch(error => {
console.log('TC_050-11 error: ' + error); console.log('Failed in creating pixelmap.' + error);
expect().assertFail();
done();
}) })
// Obtain the number of bytes in each line of pixels. // Obtain the number of bytes in each line of pixels.
pixelmap.getBytesNumberPerRow( num => { pixelmap.getBytesNumberPerRow( num => {
console.info('TC_025-1 num is ' + num); console.log('Succeeded in getting BytesNumber PerRow.');
expect(num == expectNum).assertTrue();
done();
}) })
// Obtain the total number of pixel bytes. // Obtain the total number of pixel bytes.
pixelmap.getPixelBytesNumber(num => { pixelmap.getPixelBytesNumber(num => {
console.info('TC_026-1 num is ' + num); console.log('Succeeded in getting PixelBytesNumber.');
expect(num == expectNum).assertTrue();
done();
}) })
// Obtain the pixel map information. // Obtain the pixel map information.
pixelmap.getImageInfo( imageInfo => {}) pixelmap.getImageInfo( imageInfo => {})
// Print the failure information.
console.info('TC_024-1 imageInfo is empty');
expect(false).assertTrue()
// Release the PixelMap object. // Release the PixelMap object.
pixelmap.release(()=>{ pixelmap.release(()=>{
expect(true).assertTrue(); console.log('Succeeded in releasing pixelmap');
console.log('TC_027-1 suc');
done();
}) })
// Capture release failure information. // Capture release failure information.
catch(error => { catch(error => {
console.log('TC_027-1 error: ' + error); console.log('Failed in releasing pixelmap.' + error);
expect().assertFail();
done();
}) })
``` ```
...@@ -230,9 +204,7 @@ const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.p ...@@ -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. // Print the error message if the image source fails to be created.
if (imageSourceApi == null) { if (imageSourceApi == null) {
console.info('TC_062 create image source failed'); console.log('Failed in creating imageSource.');
expect(false).assertTrue();
done();
} }
// Create an image packer if the image source is successfully created. // Create an image packer if the image source is successfully created.
...@@ -240,9 +212,7 @@ const imagePackerApi = image.createImagePacker(); ...@@ -240,9 +212,7 @@ const imagePackerApi = image.createImagePacker();
// Print the error information if the image packer fails to be created. // Print the error information if the image packer fails to be created.
if (imagePackerApi == null) { if (imagePackerApi == null) {
console.info('TC_062 create image packer failed'); console.log('Failed in creating imagePacker.');
expect(false).assertTrue();
done();
} }
// Set encoding parameters if the image packer is successfully created. // 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. ...@@ -252,19 +222,15 @@ let packOpts = { format:["image/jpeg"], // The supported encoding format is jpg.
// Encode the image. // Encode the image.
imagePackerApi.packing(imageSourceApi, packOpts) imagePackerApi.packing(imageSourceApi, packOpts)
.then( data => { .then( data => {
console.info('TC_062 finished'); console.log('Succeeded in packing');
expect(data !== null).assertTrue();
done();
}) })
// Release the image packer after the encoding is complete. // Release the image packer after the encoding is complete.
imagePackerApi.release(); imagePackerApi.release();
// Obtain the image source information. // Obtain the image source information.
imageSourceApi.getImageInfo(imageInfo => { imageSourceApi.getImageInfo(imageInfo => {
console.info('TC_045 imageInfo'); console.log('Succeeded in getting imageInfo');
expect(imageInfo !== null).assertTrue();
done();
}) })
// Update incremental data. // Update incremental data.
......
...@@ -17,11 +17,11 @@ You can `import` the native .so that contains the JS processing logic. For examp ...@@ -17,11 +17,11 @@ You can `import` the native .so that contains the JS processing logic. For examp
### .so Naming Rules ### .so Naming Rules
Each module has a .so file. For example, if the module name is `hello`, name the .so file **libhello.so**. The `nm_modname` field in `napi_module` must be `hello`, which is the same as the module name. The sample code for importing the .so file is `import hello from 'libhello.so'`. Each module has a .so file. For example, if the module name is `hello`, name the .so file `libhello.so`. The `nm_modname` field in `napi_module` must be `hello`, which is the same as the module name. The sample code for importing the .so file is `import hello from 'libhello.so'`.
### JS Objects and Threads ### JS Objects and Threads
The Ark engine prevents NAPIs from being called to operate JS objects in non-JS threads. Otherwise, the application will crash. The Ark engine prevents NAPIs from being called to operate JS objects in non-JS threads. Otherwise, the application will crash. Observe the following rules:
* The NAPIs can be used only in JS threads. * The NAPIs can be used only in JS threads.
* **env** is bound to a thread and cannot be used across threads. The JS object created by a NAPI can be used only in the thread, in which the object is created, that is, the JS object is bound to the **env** of the thread. * **env** is bound to a thread and cannot be used across threads. The JS object created by a NAPI can be used only in the thread, in which the object is created, that is, the JS object is bound to the **env** of the thread.
...@@ -640,8 +640,3 @@ export default { ...@@ -640,8 +640,3 @@ export default {
} }
} }
``` ```
## Samples
The following samples are provided for native API development:
- [`NativeAPI`: NativeAPI (eTS) (API8)](https://gitee.com/openharmony/app_samples/tree/master/Native/NativeAPI)
- [First Native C++ Application (eTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/NativeTemplateDemo)
- [Native Component (eTS) (API9) ](https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/XComponent)
...@@ -37,9 +37,7 @@ For details about the APIs, see [reminderAgent](../reference/apis/js-apis-remind ...@@ -37,9 +37,7 @@ For details about the APIs, see [reminderAgent](../reference/apis/js-apis-remind
import reminderAgent from '@ohos.reminderAgent'; import reminderAgent from '@ohos.reminderAgent';
import notification from '@ohos.notification'; import notification from '@ohos.notification';
export default { export default {
// For a JS project: // eTS project:
// timer: {
// For an eTS project:
let timer : reminderAgent.ReminderRequestTimer = { let timer : reminderAgent.ReminderRequestTimer = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER, reminderType: reminderAgent.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 10, triggerTimeInSeconds: 10,
...@@ -69,9 +67,7 @@ For details about the APIs, see [reminderAgent](../reference/apis/js-apis-remind ...@@ -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: Sample code for defining a reminder agent for a calendar event:
```js ```js
// For a JS project: // eTS project:
// calendar: {
// For an eTS project:
let calendar : reminderAgent.ReminderRequestCalendar = { let calendar : reminderAgent.ReminderRequestCalendar = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_CALENDAR, reminderType: reminderAgent.ReminderType.REMINDER_TYPE_CALENDAR,
dateTime: { dateTime: {
...@@ -117,9 +113,7 @@ For details about the APIs, see [reminderAgent](../reference/apis/js-apis-remind ...@@ -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: Sample code for defining a reminder agent for an alarm:
```js ```js
// For a JS project: // eTS project:
// alarm: {
// For an eTS project:
let alarm : reminderAgent.ReminderRequestAlarm = { let alarm : reminderAgent.ReminderRequestAlarm = {
reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM, reminderType: reminderAgent.ReminderType.REMINDER_TYPE_ALARM,
hour: 11, hour: 11,
...@@ -171,4 +165,3 @@ For details about the APIs, see [reminderAgent](../reference/apis/js-apis-remind ...@@ -171,4 +165,3 @@ For details about the APIs, see [reminderAgent](../reference/apis/js-apis-remind
<button type="text" value="publishReminder" onclick="startTimer"></button> <button type="text" value="publishReminder" onclick="startTimer"></button>
</div> </div>
``` ```
...@@ -13,14 +13,14 @@ Each application can subscribe to common events as required. After your applicat ...@@ -13,14 +13,14 @@ Each application can subscribe to common events as required. After your applicat
## Common Event Subscription Development ## Common Event Subscription Development
### When to Use ### 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 ### Available APIs
| API | Description| | API | Description|
| ---------------------------------------------------------------------------------------------- | ----------- | | ---------------------------------------------------------------------------------------------- | ----------- |
| commonEvent.createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback) | Creates a subscriber. This API uses a callback to return the result.| | 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. | | 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.| | subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback) | Subscribes to common events.|
### How to Develop ### How to Develop
1. Import the **commonEvent** module. 1. Import the **commonEvent** module.
...@@ -82,8 +82,8 @@ You can use the **publish** APIs to publish a custom common event, which can car ...@@ -82,8 +82,8 @@ You can use the **publish** APIs to publish a custom common event, which can car
### Available APIs ### Available APIs
| API | Description| | API | Description|
| ---------------------------------- | ------ | | ---------------------------------- | ------ |
| commonEvent.publish(event: string, callback: AsyncCallback) | Publishes a common event.| | 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, options: CommonEventPublishData, callback: AsyncCallback) | Publishes a common event with given attributes.|
### How to Develop ### How to Develop
#### Development for Publishing a Common Event #### Development for Publishing a Common Event
...@@ -119,7 +119,7 @@ import commonEvent from '@ohos.commonEvent' ...@@ -119,7 +119,7 @@ import commonEvent from '@ohos.commonEvent'
// Attributes of a common event. // Attributes of a common event.
var options = { var options = {
code: 1, // Result code of the common event 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. ...@@ -144,7 +144,7 @@ You can use the **unsubscribe** API to unsubscribe from a common event.
### Available APIs ### Available APIs
| API | Description| | 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 ### How to Develop
1. Import the **commonEvent** module. 1. Import the **commonEvent** module.
...@@ -153,7 +153,7 @@ You can use the **unsubscribe** API to unsubscribe from a common event. ...@@ -153,7 +153,7 @@ You can use the **unsubscribe** API to unsubscribe from a common event.
import commonEvent from '@ohos.commonEvent'; 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. 3. Invoke the **unsubscribe** API in **CommonEvent** to unsubscribe from the common event.
```js ```js
......
...@@ -7,16 +7,13 @@ Common Event Service (CES) enables applications to publish, subscribe to, and un ...@@ -7,16 +7,13 @@ Common Event Service (CES) enables applications to publish, subscribe to, and un
![ces](figures/ces.png) ![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. - 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. - 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 received SMS messages and instant messages.
- Display push messages of applications, such as advertisements, version updates, and news notifications.
- 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 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. 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) => { ...@@ -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 ## bundle.getAllBundleInfo
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array\<BundleInfo>> getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array\<BundleInfo>>
...@@ -370,6 +444,82 @@ bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => { ...@@ -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 ## bundle.getBundleInstaller
getBundleInstaller(): Promise&lt;BundleInstaller&gt;; getBundleInstaller(): Promise&lt;BundleInstaller&gt;;
...@@ -685,7 +835,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -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. | | bundleName | string | Yes | Bundle name of an application. |
| moduleName | string | Yes | Module name of the 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** **Return value**
...@@ -758,10 +908,10 @@ This is a system API and cannot be called by third-party applications. ...@@ -758,10 +908,10 @@ This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ---------------------------------- | ---- | ---------------------------------------------------- | | -------------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------- |
| bundleName | string | Yes | Bundle name of an application. | | bundleName | string | Yes | Bundle name of an application. |
| bundlePackFlag | pack.BundlePackFlag | Yes | Flags of the bundle package. | | bundlePackFlag | pack.BundlePackFlag | Yes | Flags of the bundle package. |
| callback | AsyncCallback<pack.BundlePackInfo> | Yes | Callback used to return the bundle package information.| | callback | AsyncCallback<pack.BundlePackInfo> | Yes | Callback used to return the bundle package information.|
## bundle.getBundlePackInfo<sup>9+</sup> ## bundle.getBundlePackInfo<sup>9+</sup>
...@@ -780,16 +930,16 @@ This is a system API and cannot be called by third-party applications. ...@@ -780,16 +930,16 @@ This is a system API and cannot be called by third-party applications.
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ------------------- | ---- | ---------------------- | | -------------- | ------------------------------------------------- | ---- | ---------------------- |
| bundleName | string | Yes | Bundle name of an application. | | bundleName | string | Yes | Bundle name of an application. |
| bundlePackFlag | pack.BundlePackFlag | Yes | Flags of the bundle package.| | bundlePackFlag | pack.BundlePackFlag | Yes | Flags of the bundle package.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------------- | ----------------------------------- | | ---------------------------- | ------------------------------------------------------ |
| Promise<pack.BundlePackInfo> | Promise used to return the bundle package information.| | Promise<pack.BundlePackInfo> | Promise used to return the bundle package information. |
## bundle.getDispatcherVersion<sup>9+</sup> ## bundle.getDispatcherVersion<sup>9+</sup>
...@@ -1894,7 +2044,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -1894,7 +2044,7 @@ SystemCapability.BundleManager.BundleFramework
| -------------- | ------ | ---- | ---------------------------------------- | | -------------- | ------ | ---- | ---------------------------------------- |
| want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. | | 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).| | 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. | | 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** **Return value**
...@@ -1943,7 +2093,7 @@ SystemCapability.BundleManager.BundleFramework ...@@ -1943,7 +2093,7 @@ SystemCapability.BundleManager.BundleFramework
| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. | | 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).| | 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. | | 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. | | 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 ...@@ -1986,7 +2136,7 @@ SystemCapability.BundleManager.BundleFramework
| -------------- | ---------------------------------------- | ---- | ---------------------------------------- | | -------------- | ---------------------------------------- | ---- | ---------------------------------------- |
| want | [Want](js-apis-application-Want.md) | Yes | Want that contains the bundle name. | | 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).| | 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. | | callback | AsyncCallback<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Yes | Callback used to return the Extension ability information. |
**Example** **Example**
......
...@@ -49,3 +49,51 @@ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbil ...@@ -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** ...@@ -14,19 +14,19 @@ The mission snapshot information can be obtained by using **getMissionSnapShot**
```js ```js
import ElementName from '@ohos.bundle'; import ElementName from '@ohos.bundle';
import image from '@ohos.multimedia.image'; import image from '@ohos.multimedia.image';
import missionManager from '@ohos.application.missionManager' import missionManager from '@ohos.application.missionManager';
missionManager.getMissionInfos("", 10, (error, missions) => { missionManager.getMissionInfos("", 10, (error, missions) => {
console.log("getMissionInfos is called, error.code = " + error.code); console.log("getMissionInfos is called, error.code = " + error.code);
console.log("size = " + missions.length); console.log("size = " + missions.length);
console.log("missions = " + JSON.stringify(missions)); console.log("missions = " + JSON.stringify(missions));
var id = missions[0].missionId; var id = missions[0].missionId;
missionManager.getMissionSnapShot("", id, (error, snapshot) => { missionManager.getMissionSnapShot("", id, (error, snapshot) => {
console.log("getMissionSnapShot is called, error.code = " + error.code); console.log("getMissionSnapShot is called, error.code = " + error.code);
console.log("bundleName = " + snapshot.ability.bundleName); console.log("bundleName = " + snapshot.ability.bundleName);
})
}) })
})
``` ```
## MissionSnapshot ## MissionSnapshot
......
...@@ -16,6 +16,16 @@ import buffer from '@ohos.buffer'; ...@@ -16,6 +16,16 @@ import buffer from '@ohos.buffer';
## 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
alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer 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 ...@@ -2422,7 +2432,7 @@ Creates a **Blob** instance by copying specified data from this **Blob** instanc
let blob3 = blob.slice(0, 2, "MIME"); let blob3 = blob.slice(0, 2, "MIME");
``` ```
### text ### text
text(): Promise&lt;string&gt; text(): Promise&lt;string&gt;
......
...@@ -195,7 +195,7 @@ Moves to the specified row in the result set. ...@@ -195,7 +195,7 @@ Moves to the specified row in the result set.
**Example** **Example**
```ts ```ts
let goToRowNum = 2 let goToRowNum = 2;
let isGoToRow = resultSet.goToRow(goToRowNum); let isGoToRow = resultSet.goToRow(goToRowNum);
console.info('resultSet.goToRow: ' + isGoToRow); 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 ...@@ -223,7 +223,7 @@ Obtains the value in the form of a byte array based on the specified column and
**Example** **Example**
```ts ```ts
let columnIndex = 1 let columnIndex = 1;
let goToFirstRow = resultSet.goToFirstRow(); let goToFirstRow = resultSet.goToFirstRow();
let getBlob = resultSet.getBlob(columnIndex); let getBlob = resultSet.getBlob(columnIndex);
console.info('resultSet.getBlob: ' + getBlob); console.info('resultSet.getBlob: ' + getBlob);
...@@ -231,7 +231,7 @@ console.info('resultSet.getBlob: ' + getBlob); ...@@ -231,7 +231,7 @@ console.info('resultSet.getBlob: ' + getBlob);
### getString ### 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. 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 ...@@ -252,7 +252,7 @@ Obtains the value in the form of a string based on the specified column and the
**Example** **Example**
```ts ```ts
let columnIndex = 1 let columnIndex = 1;
let goToFirstRow = resultSet.goToFirstRow(); let goToFirstRow = resultSet.goToFirstRow();
let getString = resultSet.getString(columnIndex); let getString = resultSet.getString(columnIndex);
console.info('resultSet.getString: ' + getString); 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 ...@@ -281,7 +281,7 @@ Obtains the value in the form of a long integer based on the specified column an
**Example** **Example**
```ts ```ts
let columnIndex = 1 let columnIndex = 1;
let goToFirstRow = resultSet.goToFirstRow(); let goToFirstRow = resultSet.goToFirstRow();
let getLong = resultSet.getLong(columnIndex); let getLong = resultSet.getLong(columnIndex);
console.info('resultSet.getLong: ' + getLong); console.info('resultSet.getLong: ' + getLong);
...@@ -310,7 +310,7 @@ Obtains the value in the form of a double-precision floating-point number based ...@@ -310,7 +310,7 @@ Obtains the value in the form of a double-precision floating-point number based
**Example** **Example**
```ts ```ts
let columnIndex = 1 let columnIndex = 1;
let goToFirstRow = resultSet.goToFirstRow(); let goToFirstRow = resultSet.goToFirstRow();
let getDouble = resultSet.getDouble(columnIndex); let getDouble = resultSet.getDouble(columnIndex);
console.info('resultSet.getDouble: ' + getDouble); console.info('resultSet.getDouble: ' + getDouble);
...@@ -353,14 +353,14 @@ Obtains the column index based on the column name. ...@@ -353,14 +353,14 @@ Obtains the column index based on the column name.
**Example** **Example**
```ts ```ts
let ColumnName = "name" let ColumnName = "name";
let getColumnIndex = resultSet.getColumnIndex(ColumnName) let getColumnIndex = resultSet.getColumnIndex(ColumnName);
console.info('resultSet.getColumnIndex: ' + getColumnIndex); console.info('resultSet.getColumnIndex: ' + getColumnIndex);
``` ```
### getColumnName ### getColumnName
getColumnName(columnIndex: number): *string* getColumnName(columnIndex: number): string
Obtains the column name based on the column index. Obtains the column name based on the column index.
...@@ -381,8 +381,8 @@ Obtains the column name based on the column index. ...@@ -381,8 +381,8 @@ Obtains the column name based on the column index.
**Example** **Example**
```ts ```ts
let columnIndex = 1 let columnIndex = 1;
let getColumnName = resultSet.getColumnName(columnIndex) let getColumnName = resultSet.getColumnName(columnIndex);
console.info('resultSet.getColumnName: ' + getColumnName); console.info('resultSet.getColumnName: ' + getColumnName);
``` ```
......
...@@ -2,6 +2,8 @@ ...@@ -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. 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** > **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 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. ...@@ -22,7 +24,7 @@ Provides methods for setting different **DataSharePredicates** objects.
equalTo(field: string, value: ValueType): DataSharePredicates 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. Currently, only the relational database (RDB) and key-value database (KVDB, schema) support this **DataSharePredicates** object.
...@@ -52,7 +54,7 @@ predicates.equalTo("NAME", "Rose") ...@@ -52,7 +54,7 @@ predicates.equalTo("NAME", "Rose")
notEqualTo(field: string, value: ValueType): DataSharePredicates 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. Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
...@@ -188,7 +190,7 @@ predicates.equalTo("NAME", "lisi") ...@@ -188,7 +190,7 @@ predicates.equalTo("NAME", "lisi")
contains(field: string, value: string): DataSharePredicates 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. Currently, only the RDB supports this **DataSharePredicates** object.
...@@ -218,7 +220,7 @@ predicates.contains("NAME", "os") ...@@ -218,7 +220,7 @@ predicates.contains("NAME", "os")
beginsWith(field: string, value: string): DataSharePredicates 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. Currently, only the RDB supports this **DataSharePredicates** object.
...@@ -248,7 +250,7 @@ predicates.beginsWith("NAME", "os") ...@@ -248,7 +250,7 @@ predicates.beginsWith("NAME", "os")
endsWith(field: string, value: string): DataSharePredicates 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. Currently, only the RDB supports this **DataSharePredicates** object.
...@@ -278,7 +280,7 @@ predicates.endsWith("NAME", "os") ...@@ -278,7 +280,7 @@ predicates.endsWith("NAME", "os")
isNull(field: string): DataSharePredicates 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. Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
...@@ -307,7 +309,7 @@ predicates.isNull("NAME") ...@@ -307,7 +309,7 @@ predicates.isNull("NAME")
isNotNull(field: string): DataSharePredicates 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. Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
...@@ -336,7 +338,7 @@ predicates.isNotNull("NAME") ...@@ -336,7 +338,7 @@ predicates.isNotNull("NAME")
like(field: string, value: string): DataSharePredicates 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. 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 ...@@ -347,7 +349,7 @@ Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** o
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------- | | ------ | ------ | ---- | ---------------------- |
| field | string | Yes | Column name in the database table. | | 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** **Return value**
...@@ -366,7 +368,7 @@ predicates.like("NAME", "%os%") ...@@ -366,7 +368,7 @@ predicates.like("NAME", "%os%")
unlike(field: string, value: string): DataSharePredicates 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. 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 ...@@ -377,7 +379,7 @@ Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** o
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------- | | ------ | ------ | ---- | ---------------------- |
| field | string | Yes | Column name in the database table. | | 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** **Return value**
...@@ -396,7 +398,7 @@ predicates.unlike("NAME", "%os%") ...@@ -396,7 +398,7 @@ predicates.unlike("NAME", "%os%")
glob(field: string, value: string): DataSharePredicates 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. Currently, only the RDB supports this **DataSharePredicates** object.
...@@ -407,7 +409,7 @@ Currently, only the RDB supports this **DataSharePredicates** object. ...@@ -407,7 +409,7 @@ Currently, only the RDB supports this **DataSharePredicates** object.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------- | | ------ | ------ | ---- | ---------------------- |
| field | string | Yes | Column name in the database table. | | 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** **Return value**
...@@ -426,7 +428,7 @@ predicates.glob("NAME", "?h*g") ...@@ -426,7 +428,7 @@ predicates.glob("NAME", "?h*g")
between(field: string, low: ValueType, high: ValueType): DataSharePredicates 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. Currently, only the RDB supports this **DataSharePredicates** object.
...@@ -457,7 +459,7 @@ predicates.between("AGE", 10, 50) ...@@ -457,7 +459,7 @@ predicates.between("AGE", 10, 50)
notBetween(field: string, low: ValueType, high: ValueType): DataSharePredicates 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. Currently, only the RDB supports this **DataSharePredicates** object.
...@@ -488,7 +490,7 @@ predicates.notBetween("AGE", 10, 50) ...@@ -488,7 +490,7 @@ predicates.notBetween("AGE", 10, 50)
greaterThan(field: string, value: ValueType): DataSharePredicates 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. Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
...@@ -518,7 +520,7 @@ predicates.greaterThan("AGE", 10) ...@@ -518,7 +520,7 @@ predicates.greaterThan("AGE", 10)
lessThan(field: string, value: ValueType): DataSharePredicates 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. Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
...@@ -548,7 +550,7 @@ predicates.lessThan("AGE", 50) ...@@ -548,7 +550,7 @@ predicates.lessThan("AGE", 50)
greaterThanOrEqualTo(field: string, value: ValueType): DataSharePredicates 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. Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
...@@ -578,7 +580,7 @@ predicates.greaterThanOrEqualTo("AGE", 10) ...@@ -578,7 +580,7 @@ predicates.greaterThanOrEqualTo("AGE", 10)
lessThanOrEqualTo(field: string, value: ValueType): DataSharePredicates 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. Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
...@@ -777,7 +779,7 @@ predicates.indexedBy("SALARY_INDEX") ...@@ -777,7 +779,7 @@ predicates.indexedBy("SALARY_INDEX")
in(field: string, value: Array&lt;ValueType&gt;): DataSharePredicates 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. Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
...@@ -807,7 +809,7 @@ predicates.in("AGE", [18, 20]) ...@@ -807,7 +809,7 @@ predicates.in("AGE", [18, 20])
notIn(field: string, value: Array&lt;ValueType&gt;): DataSharePredicates 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. Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
...@@ -837,7 +839,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"]) ...@@ -837,7 +839,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"])
prefixKey(prefix: string): DataSharePredicates 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. Currently, only the KVDB supports this **DataSharePredicates** object.
...@@ -866,7 +868,7 @@ predicates.prefixKey("NAME") ...@@ -866,7 +868,7 @@ predicates.prefixKey("NAME")
inKeys(keys: Array&lt;string&gt;): DataSharePredicates 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. Currently, only the KVDB supports this **DataSharePredicates** object.
......
...@@ -6,26 +6,25 @@ A result set is a set of results returned after the relational database (RDB) qu ...@@ -6,26 +6,25 @@ A result set is a set of results returned after the relational database (RDB) qu
> >
> 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 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.
## Usage ## Usage
You need to use [RdbStore.query()](js-apis-data-rdb.md#query) to obtain a **resultSet** object. You need to use [RdbStore.query()](js-apis-data-rdb.md#query) to obtain a **resultSet** object.
```js ```js
import dataRdb from '@ohos.data.rdb'; import dataRdb from '@ohos.data.rdb';
let predicates = new dataRdb.RdbPredicates("EMPLOYEE") let predicates = new dataRdb.RdbPredicates("EMPLOYEE");
predicates.equalTo("AGE", 18) predicates.equalTo("AGE", 18);
let promise = rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]) let promise = rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => { promise.then((resultSet) => {
console.log(TAG + "resultSet columnNames:" + resultSet.columnNames); console.log(TAG + "resultSet columnNames:" + resultSet.columnNames);
console.log(TAG + "resultSet columnCount:" + resultSet.columnCount);}) console.log(TAG + "resultSet columnCount:" + resultSet.columnCount);
});
``` ```
## ResultSet ## ResultSet
Provides methods to access the result set, which is obtained by querying the RDB store. Provides methods to access the result set, which is obtained by querying the RDB store.
### Attributes ### Attributes
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
...@@ -42,7 +41,6 @@ Provides methods to access the result set, which is obtained by querying the RDB ...@@ -42,7 +41,6 @@ Provides methods to access the result set, which is obtained by querying the RDB
| isStarted | boolean | Yes| Whether the cursor has been moved.| | isStarted | boolean | Yes| Whether the cursor has been moved.|
| isClosed | boolean | Yes| Whether the result set is closed.| | isClosed | boolean | Yes| Whether the result set is closed.|
### getColumnIndex ### getColumnIndex
getColumnIndex(columnName: string): number getColumnIndex(columnName: string): number
...@@ -52,25 +50,27 @@ Obtains the column index based on the column name. ...@@ -52,25 +50,27 @@ Obtains the column index based on the column name.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| columnName | string | Yes| Column name specified.| | columnName | string | Yes| Column name specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Index of the column obtained.| | number | Index of the column obtained.|
**Example** **Example**
```js ```js
resultSet.goToFirstRow() resultSet.goToFirstRow();
const id = resultSet.getLong(resultSet.getColumnIndex("ID")) const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME")) const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE")) const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY")) const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
``` ```
### getColumnName ### getColumnName
getColumnName(columnIndex: number): string getColumnName(columnIndex: number): string
...@@ -80,23 +80,25 @@ Obtains the column name based on the column index. ...@@ -80,23 +80,25 @@ Obtains the column name based on the column index.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Column index specified.| | columnIndex | number | Yes| Column index specified.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Column name obtained.| | string | Column name obtained.|
**Example** **Example**
```js ```js
const id = resultSet.getColumnName(0) const id = resultSet.getColumnName(0);
const name = resultSet.getColumnName(1) const name = resultSet.getColumnName(1);
const age = resultSet.getColumnName(2) const age = resultSet.getColumnName(2);
``` ```
### goTo ### goTo
goTo(offset:number): boolean goTo(offset:number): boolean
...@@ -106,28 +108,30 @@ Moves the cursor to the row based on the specified offset. ...@@ -106,28 +108,30 @@ Moves the cursor to the row based on the specified offset.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| offset | number | Yes| Offset relative to the current position.| | offset | number | Yes| Offset relative to the current position.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example** **Example**
```js ```js
let predicatesgoto = new dataRdb.RdbPredicates("EMPLOYEE") let predicatesgoto = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygoto = rdbStore.query(predicatesgoto, ["ID", "NAME", "AGE", "SALARY", "CODES"]) let promisequerygoto = rdbStore.query(predicatesgoto, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoto.then((resultSet) { promisequerygoto.then((resultSet) {
resultSet.goTo(1) resultSet.goTo(1);
resultSet.close() resultSet.close();
}).catch((err) => { }).catch((err) => {
console.log('query failed') console.log('query failed');
}) });
``` ```
### goToRow ### goToRow
goToRow(position: number): boolean goToRow(position: number): boolean
...@@ -137,28 +141,30 @@ Moves the cursor to the specified row in the result set. ...@@ -137,28 +141,30 @@ Moves the cursor to the specified row in the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| position | number | Yes| Position to which the cursor is to be moved.| | position | number | Yes| Position to which the cursor is to be moved.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example** **Example**
```js ```js
let predicatesgotorow = new dataRdb.RdbPredicates("EMPLOYEE") let predicatesgotorow = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygotorow = rdbStore.query(predicatesgotorow, ["ID", "NAME", "AGE", "SALARY", "CODES"]) let promisequerygotorow = rdbStore.query(predicatesgotorow, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygotorow.then((resultSet) { promisequerygotorow.then((resultSet) {
resultSet.goToRow(5) resultSet.goToRow(5);
resultSet.close() resultSet.close();
}).catch((err) => { }).catch((err) => {
console.log('query failed') console.log('query failed');
}) });
``` ```
### goToFirstRow ### goToFirstRow
goToFirstRow(): boolean goToFirstRow(): boolean
...@@ -169,23 +175,24 @@ Moves the cursor to the first row of the result set. ...@@ -169,23 +175,24 @@ Moves the cursor to the first row of the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example** **Example**
```js ```js
let predicatesgoFirst = new dataRdb.RdbPredicates("EMPLOYEE") let predicatesgoFirst = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygoFirst = rdbStore.query(predicatesgoFirst, ["ID", "NAME", "AGE", "SALARY", "CODES"]) let promisequerygoFirst = rdbStore.query(predicatesgoFirst, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoFirst.then((resultSet) { promisequerygoFirst.then((resultSet) {
resultSet.goToFirstRow() resultSet.goToFirstRow();
resultSet.close() resultSet.close();
}).catch((err) => { }).catch((err) => {
console.log('query failed') console.log('query failed');
}) });
``` ```
### goToLastRow ### goToLastRow
goToLastRow(): boolean goToLastRow(): boolean
...@@ -195,23 +202,24 @@ Moves the cursor to the last row of the result set. ...@@ -195,23 +202,24 @@ Moves the cursor to the last row of the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example** **Example**
```js ```js
let predicatesgoLast = new dataRdb.RdbPredicates("EMPLOYEE") let predicatesgoLast = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygoLast = rdbStore.query(predicatesgoLast, ["ID", "NAME", "AGE", "SALARY", "CODES"]) let promisequerygoLast = rdbStore.query(predicatesgoLast, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoLast.then((resultSet) { promisequerygoLast.then((resultSet) {
resultSet.goToLastRow() resultSet.goToLastRow();
resultSet.close() resultSet.close();
}).catch((err) => { }).catch((err) => {
console.log('query failed') console.log('query failed');
}) });
``` ```
### goToNextRow ### goToNextRow
goToNextRow(): boolean goToNextRow(): boolean
...@@ -221,23 +229,24 @@ Moves the cursor to the next row in the result set. ...@@ -221,23 +229,24 @@ Moves the cursor to the next row in the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example** **Example**
```js ```js
let predicatesgoNext = new dataRdb.RdbPredicates("EMPLOYEE") let predicatesgoNext = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygoNext = rdbStore.query(predicatesgoNext, ["ID", "NAME", "AGE", "SALARY", "CODES"]) let promisequerygoNext = rdbStore.query(predicatesgoNext, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoNext.then((resultSet) { promisequerygoNext.then((resultSet) {
resultSet.goToNextRow() resultSet.goToNextRow();
resultSet.close() resultSet.close();
}).catch((err) => { }).catch((err) => {
console.log('query failed') console.log('query failed');
}) });
``` ```
### goToPreviousRow ### goToPreviousRow
goToPreviousRow(): boolean goToPreviousRow(): boolean
...@@ -247,23 +256,24 @@ Moves the cursor to the previous row in the result set. ...@@ -247,23 +256,24 @@ Moves the cursor to the previous row in the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| | boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
**Example** **Example**
```js ```js
let predicatesgoPrev = new dataRdb.RdbPredicates("EMPLOYEE") let predicatesgoPrev = new dataRdb.RdbPredicates("EMPLOYEE");
let promisequerygoPrev = rdbStore.query(predicatesgoPrev, ["ID", "NAME", "AGE", "SALARY", "CODES"]) let promisequerygoPrev = rdbStore.query(predicatesgoPrev, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promisequerygoPrev.then((resultSet) { promisequerygoPrev.then((resultSet) {
resultSet.goToPreviousRow() resultSet.goToPreviousRow();
resultSet.close() resultSet.close();
}).catch((err) => { }).catch((err) => {
console.log('query failed') console.log('query failed');
}) });
``` ```
### getBlob ### getBlob
getBlob(columnIndex: number): Uint8Array getBlob(columnIndex: number): Uint8Array
...@@ -273,21 +283,23 @@ Obtains the value in the specified column in the current row as a byte array. ...@@ -273,21 +283,23 @@ Obtains the value in the specified column in the current row as a byte array.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.| | columnIndex | number | Yes| Index of the specified column, starting from 0.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| Uint8Array | Value in the specified column as a byte array.| | Uint8Array | Value in the specified column as a byte array.|
**Example** **Example**
```js ```js
const codes = resultSet.getBlob(resultSet.getColumnIndex("CODES")) const codes = resultSet.getBlob(resultSet.getColumnIndex("CODES"));
``` ```
### getString ### getString
getString(columnIndex: number): string getString(columnIndex: number): string
...@@ -297,21 +309,23 @@ Obtains the value in the specified column in the current row as a string. ...@@ -297,21 +309,23 @@ Obtains the value in the specified column in the current row as a string.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.| | columnIndex | number | Yes| Index of the specified column, starting from 0.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Value in the specified column as a string.| | string | Value in the specified column as a string.|
**Example** **Example**
```js ```js
const name = resultSet.getString(resultSet.getColumnIndex("NAME")) const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
``` ```
### getLong ### getLong
getLong(columnIndex: number): number getLong(columnIndex: number): number
...@@ -321,21 +335,23 @@ Obtains the value in the specified column in the current row as a Long. ...@@ -321,21 +335,23 @@ Obtains the value in the specified column in the current row as a Long.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.| | columnIndex | number | Yes| Index of the specified column, starting from 0.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Value in the specified column as a Long.| | number | Value in the specified column as a Long.|
**Example** **Example**
```js ```js
const age = resultSet.getLong(resultSet.getColumnIndex("AGE")) const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
``` ```
### getDouble ### getDouble
getDouble(columnIndex: number): number getDouble(columnIndex: number): number
...@@ -345,21 +361,23 @@ Obtains the value in the specified column in the current row as a double. ...@@ -345,21 +361,23 @@ Obtains the value in the specified column in the current row as a double.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.| | columnIndex | number | Yes| Index of the specified column, starting from 0.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| number | Value in the specified column as a double.| | number | Value in the specified column as a double.|
**Example** **Example**
```js ```js
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY")) const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
``` ```
### isColumnNull ### isColumnNull
isColumnNull(columnIndex: number): boolean isColumnNull(columnIndex: number): boolean
...@@ -369,21 +387,23 @@ Checks whether the value in the specified column of the current row is null. ...@@ -369,21 +387,23 @@ Checks whether the value in the specified column of the current row is null.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.| | columnIndex | number | Yes| Index of the specified column, starting from 0.|
**Return value** **Return value**
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| boolean | Returns **true** if the value is null; returns **false** otherwise.| | boolean | Returns **true** if the value is null; returns **false** otherwise.|
**Example** **Example**
```js ```js
const isColumnNull = resultSet.isColumnNull(resultSet.getColumnIndex("CODES")) const isColumnNull = resultSet.isColumnNull(resultSet.getColumnIndex("CODES"));
``` ```
### close ### close
close(): void close(): void
...@@ -393,12 +413,13 @@ Closes this result set. ...@@ -393,12 +413,13 @@ Closes this result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Example** **Example**
```js ```js
let predicatesClose = new dataRdb.RdbPredicates("EMPLOYEE") let predicatesClose = new dataRdb.RdbPredicates("EMPLOYEE");
let promiseClose = rdbStore.query(predicatesClose, ["ID", "NAME", "AGE", "SALARY", "CODES"]) let promiseClose = rdbStore.query(predicatesClose, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promiseClose.then((resultSet) { promiseClose.then((resultSet) {
resultSet.close() resultSet.close();
}).catch((err) => { }).catch((err) => {
console.log('Failed to close resultset') console.log('Failed to close resultset');
}) });
``` ```
...@@ -24,7 +24,7 @@ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => { ...@@ -24,7 +24,7 @@ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
## DeviceSettingsManager.setDateTime ## 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. 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 ...@@ -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.| | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application.|
| time | number | Yes| Timestamp (ms).| | 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** **Example**
...@@ -64,7 +64,7 @@ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => { ...@@ -64,7 +64,7 @@ enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
## DeviceSettingsManager.setDateTime ## 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. 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. ...@@ -83,8 +83,7 @@ Sets the system time. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| ----- | ----------------------------------- | | ----- | ----------------------------------- |
| Promise<void> | Promise that returns no value.| | Promise\<void> | Promise that returns no value.|
**Example** **Example**
......
...@@ -128,7 +128,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -128,7 +128,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| IterableIterator&lt;[string,&nbsp;string]&gt; | ES6 iterator.| | IterableIterator&lt;[string, string]&gt; | ES6 iterator.|
**Example** **Example**
...@@ -192,7 +192,7 @@ Obtains the value of the first key-value pair based on the specified key. ...@@ -192,7 +192,7 @@ Obtains the value of the first key-value pair based on the specified key.
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| string | Returns the value of the first key-value pair if obtained.| | string | Returns the value of the first key-value pair if obtained.|
| null | Returns null if no value is obtained.| | null | Returns **null** if no value is obtained.|
**Example** **Example**
...@@ -333,7 +333,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th ...@@ -333,7 +333,7 @@ Obtains an ES6 iterator. Each item of the iterator is a JavaScript array, and th
| Type| Description| | Type| Description|
| -------- | -------- | | -------- | -------- |
| IterableIterator&lt;[string,&nbsp;string]&gt; | ES6 iterator.| | IterableIterator&lt;[string, string]&gt; | ES6 iterator.|
**Example** **Example**
...@@ -404,7 +404,7 @@ Creates a URL. ...@@ -404,7 +404,7 @@ Creates a URL.
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| url | string | Yes| Input object.| | url | string | Yes| Input object.|
| base | string&nbsp;\|&nbsp;URL | No| Input parameter, which can be any of the following:<br>- **string**: string<br>- **URL**: string or object| | base | string \| URL | No| Input parameter, which can be any of the following:<br>- **string**: string<br>- **URL**: string or object|
**Example** **Example**
...@@ -442,7 +442,7 @@ Converts the parsed URL into a string. ...@@ -442,7 +442,7 @@ Converts the parsed URL into a string.
```js ```js
const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toString() url.toString();
``` ```
...@@ -463,5 +463,5 @@ Converts the parsed URL into a JSON string. ...@@ -463,5 +463,5 @@ Converts the parsed URL into a JSON string.
**Example** **Example**
```js ```js
const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const url = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da');
url.toJSON() url.toJSON();
``` ```
...@@ -8,7 +8,7 @@ The **\<CheckboxGroup>** component is used to select or deselect all check boxes ...@@ -8,7 +8,7 @@ The **\<CheckboxGroup>** component is used to select or deselect all check boxes
## Child Components ## Child Components
None Not supported
## APIs ## APIs
...@@ -18,8 +18,6 @@ Creates a check box group so that you can select or deselect all check boxes in ...@@ -18,8 +18,6 @@ Creates a check box group so that you can select or deselect all check boxes in
**Parameters** **Parameters**
| Name| Type| Mandatory| Description| | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| group | string | No| Group name.| | group | string | No| Group name.|
......
...@@ -27,7 +27,7 @@ Obtains an image from the specified source for subsequent rendering and display. ...@@ -27,7 +27,7 @@ Obtains an image from the specified source for subsequent rendering and display.
| Name| Type | Mandatory| Description | | 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 ## Attributes
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册