未验证 提交 75ea3c8e 编写于 作者: O openharmony_ci 提交者: Gitee

!13312 翻译已完成12332+12384+12442+12654+12629

Merge pull request !13312 from shawn_he/12332-a
......@@ -48,28 +48,28 @@ var callback = {
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
console.log("[Demo] MainAbility onCreate")
registerId = errorManager.registerErrorObserver(callback);
globalThis.abilityWant = want;
}
onDestroy() {
console.log("[Demo] MainAbility onDestroy")
errorManager.unregisterErrorObserver(registerId, (result) => {
console.log("[Demo] result " + result.code + ";" + result.message)
});
}
onWindowStageCreate(windowStage) {
// Main window is created for this ability.
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.registerObserver = (() => {
registerId = errorManager.registerErrorObserver(callback);
})
globalThis.unRegisterObserver = (() => {
errorManager.unregisterErrorObserver(registerId, (result) => {
console.log("[Demo] result " + result.code + ";" + result.message)
});
})
windowStage.setUIContent(this.context, "pages/index", null)
windowStage.loadContent("pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
return;
}
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
}
onWindowStageDestroy() {
......
......@@ -83,6 +83,7 @@ You can create resource group subdirectories (including element, media, and prof
| ------- | ---------------------------------------- | ---------------------------------------- |
| element | Indicates element resources. Each type of data is represented by a JSON file. The options are as follows:<br>- **boolean**: boolean data<br>- **color**: color data<br>- **float**: floating-point data<br>- **intarray**: array of integers<br>- **integer**: integer data<br>- **pattern**: pattern data<br>- **plural**: plural form data<br>- **strarray**: array of strings<br>- **string**: string data| It is recommended that files in the **element** subdirectory be named the same as the following files, each of which can contain only data of the same type:<br>- boolean.json<br>- color.json<br>- float.json<br>- intarray.json<br>- integer.json<br>- pattern.json<br>- plural.json<br>- strarray.json<br>- string.json |
| media | Indicates media resources, including non-text files such as images, audios, and videos. | The file name can be customized, for example, **icon.png**. |
| profile | Indicates a user-defined configuration file. You can obtain the file content by using the [getProfileByAbility](../reference/apis/js-apis-bundleManager.md#bundlemanagergetprofilebyability) API. | The file name can be customized, for example, **test_profile.json**. |
| rawfile | Indicates other types of files, which are stored in their raw formats after the application is built as an HAP file. They will not be integrated into the **resources.index** file.| The file name can be customized. |
**Media Resource Types**
......
......@@ -33,7 +33,7 @@ Obtains the IDs of all input devices. This API uses an asynchronous callback to
```js
try {
inputDevice.getDeviceList((error, ids) => {
inputDevice.getDeviceIds((error, ids) => {
if (error) {
console.log(`Failed to get device list.
error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`);
......@@ -65,7 +65,7 @@ Obtains the IDs of all input devices. This API uses a promise to return the resu
```js
try {
inputDevice.getDeviceList().then((ids) => {
inputDevice.getDeviceIds().then((ids) => {
console.log("The device ID list is: " + ids);
});
} catch (error) {
......@@ -245,10 +245,15 @@ This API is deprecated since API version 9. You are advised to use [inputDevice.
**Example**
```js
inputDevice.getDeviceIds((ids)=>{
console.log("The device ID list is: " + ids);
inputDevice.getDeviceIds((error, ids) => {
if (error) {
console.log(`Failed to get device id list, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Device id list: ${JSON.stringify(ids)}`);
});
```
```
## inputDevice.getDeviceIds<sup>(deprecated)</sup>
......@@ -269,8 +274,8 @@ This API is deprecated since API version 9. You are advised to use [inputDevice.
**Example**
```js
inputDevice.getDeviceIds().then((ids)=>{
console.log("The device ID list is: " + ids);
inputDevice.getDeviceIds().then((ids) => {
console.log(`Device id list: ${JSON.stringify(ids)}`);
});
```
......@@ -295,8 +300,12 @@ This API is deprecated since API version 9. You are advised to use [inputDevice.
```js
// Obtain the name of the device whose ID is 1.
inputDevice.getDevice(1, (inputDevice)=>{
console.log("The device name is: " + inputDevice.name);
inputDevice.getDevice(1, (error, deviceData) => {
if (error) {
console.log(`Failed to get device info, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Device info: ${JSON.stringify(deviceData)}`);
});
```
......@@ -326,8 +335,8 @@ This API is deprecated since API version 9. You are advised to use [inputDevice.
```js
// Obtain the name of the device whose ID is 1.
inputDevice.getDevice(1).then((inputDevice)=>{
console.log("The device name is: " + inputDevice.name);
inputDevice.getDevice(1).then((deviceData) => {
console.log(`Device info: ${JSON.stringify(deviceData)}`);
});
```
......
......@@ -19,7 +19,7 @@ Other APIs are not affected.
**Key API/Component Changes**
| Class| API Type| API Declaration| Change Type|
| Class| Type| Declaration| Change Type|
| -- | -- | -- | -- |
|geolocation| namespace | declare namespacegeolocation| Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | interface | export interface ReverseGeocodingMockInfo | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
......@@ -52,8 +52,8 @@ Other APIs are not affected.
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array&lt;ReverseGeocodingMockInfo&gt;): Promise&lt;void&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback&lt;boolean&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType): Promise&lt;boolean&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback&lt;boolean&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts** and changed the callback return value to **void**. |
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise&lt;boolean&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts** and changed the promise return value to **void**. |
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback&lt;boolean&gt;): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts** and changed the return value in the callback to **void**. |
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise&lt;boolean&gt;; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts** and changed the return value in the promise to **void**. |
**(Optional) Adaptation Guide**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册