未验证 提交 04f3cf5a 编写于 作者: O openharmony_ci 提交者: Gitee

!16174 翻译完成:15839+16100 接口一致性修改

Merge pull request !16174 from wusongqing/TR15839
......@@ -346,6 +346,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
| 9700001 | Memory operation failed. |
| 9700002 | Parcel operation failed. |
| 9700003 | System service operation failed. |
| 9700004 | Check workInfo failed. |
**Example**
......@@ -391,6 +392,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes
| 9700001 | Memory operation failed. |
| 9700002 | Parcel operation failed. |
| 9700003 | System service operation failed. |
| 9700004 | Check workInfo failed. |
**Example**
......
# @system.app (Application Context)
> **NOTE**
>
> - The APIs of this module are no longer maintained since API version 7. You are advised to use the new APIs.
>
> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -9,8 +10,8 @@
## Modules to Import
```ts
import app from '@system.app'
```
import app from '@system.app';
```
......@@ -20,8 +21,8 @@ getInfo(): AppResponse
Obtains the declared information in the **config.json** file of an application.
> **NOTE**
>
> **NOTE**
>
> You are advised to use [@ohos.bundle](js-apis-Bundle.md) since API version 7.
**System capability**: SystemCapability.ArkUI.ArkUI.Lite
......@@ -34,13 +35,13 @@ Obtains the declared information in the **config.json** file of an application.
**Example**
```ts
export default {
getInfo() {
let info = app.getInfo()
console.log(JSON.stringify(info))
```
export default {
getInfo(){
var info = app.getInfo();
console.log(JSON.stringify(info));
}
}
}
```
## app.terminate
......@@ -49,20 +50,19 @@ terminate(): void
Terminates the current ability.
> **NOTE**
>
> **NOTE**
>
> You are advised to use [@ohos.ability.featureAbility](js-apis-ability-featureAbility.md) since API version 7.
**System capability**: SystemCapability.ArkUI.ArkUI.Lite
**Example**
```ts
export default {
terminate() {
app.terminate()
}
}
```
export default {
terminate(){
app.terminate();
}}
```
## app.requestFullWindow
......@@ -70,29 +70,27 @@ requestFullWindow(options?: RequestFullWindowOptions): void
Requests the application to run in full window. You can call this API when the FA runs in a non-full window, for example, semi-modal FA. This API is invalid for an application already in full-window mode.
This is a system API and cannot be called by third-party applications.
> **NOTE**
>
> **NOTE**
>
> You are advised to use [@ohos.window](js-apis-window.md) since API version 7.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| options | [RequestFullWindowOptions](#requestfullwindowoptions) | No| Duration for transition from the non-full window to the full window, in milliseconds. By default, the value is in direct proportion to the distance between the non-full window and the full window.|
**Example**
```ts
export default {
requestFullWindow() {
app.requestFullWindow({
duration: 200
})
```
export default {
requestFullWindow(){
app.requestFullWindow({
duration: 200});
}
}
}
```
## app.setImageCacheCount<sup>7+</sup>
......@@ -104,25 +102,26 @@ Sets the maximum number of decoded images that can be cached in the memory to sp
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | number | No| Number of decoded images that are cached in the memory.|
| value | number | Yes| Number of decoded images that are cached in the memory.|
**Example**
```ts
// app.ets
import app from '@system.app'
export default {
onCreate() {
app.setImageCacheCount(100) // Set the maximum number of decoded images that can be cached in the memory to 100.
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
```
// app.ets
import app from '@system.app';
export default {
onCreate() {
app.setImageCacheCount(100) // Set the maximum number of decoded images that can be cached in the memory to 100.
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
```
## app.setImageRawDataCacheSize<sup>7+</sup>
......@@ -134,26 +133,27 @@ Sets the maximum size (in bytes) of the image data cached in the memory before d
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | number | No| Size of the image data cached before decoding, in bytes.|
| value | number | Yes| Size of the image data cached before decoding, in bytes.|
**Example**
```ts
// app.ets
import app from '@system.app'
export default {
onCreate() {
app.setImageRawDataCacheSize(104857600)
// Set the upper limit of the memory for caching image data before decoding to 100 MB. (100 x 1024 x 1024 B =104857600 B = 100 MB).
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
```
// app.ets
import app from '@system.app';
export default {
onCreate() {
app.setImageRawDataCacheSize(104857600)
// Set the upper limit of the memory for caching image data before decoding to 100 MB. (100 x 1024 x 1024 B =104857600 B = 100 MB).
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
```
## app.setImageFileCacheSize<sup>7+</sup>
......@@ -165,26 +165,27 @@ Sets the maximum size of the image file cache (in bytes) to speed up the loading
**System capability**: SystemCapability.ArkUI.ArkUI.Full
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | number | No| Size of the image file cache, in bytes.|
| value | number | Yes| Size of the image file cache, in bytes.|
**Example**
```ts
// app.ets
import app from '@system.app'
export default {
onCreate() {
app.setImageFileCacheSize(209715200)
// Set the upper limit of the image file cache to 200 MB. (200 x 1024 x 1024 B= 209715200 B = 200 MB).
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
```
// app.ets
import app from '@system.app';
export default {
onCreate() {
app.setImageFileCacheSize(209715200)
// Set the upper limit of the image file cache to 200 MB. (200 x 1024 x 1024 B= 209715200 B = 200 MB).
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
```
## AppResponse
......@@ -200,6 +201,22 @@ Defines the application response information.
| versionName | string | Yes| Application version name.<br> **System capability**: SystemCapability.ArkUI.ArkUI.Lite|
| versionCode | number | Yes| Application version number.<br> **System capability**: SystemCapability.ArkUI.ArkUI.Lite|
## ScreenOnVisible<sup>(deprecated)</sup>
screenOnVisible(options?: ScreenOnVisibleOptions):&nbsp;void
Defines whether to keep the application visible when the screen is woken up.
> **NOTE**
>
> This API is deprecated since API Version 8.
**System capability**: SystemCapability.ArkUI.ArkUI.Full
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- |-------- |
| options | ScreenOnVisibleOptions | No| With keep-alive, the system is prevented from returning to the home screen when the screen is locked, so that the application is visible when the screen is woken up. |
## ScreenOnVisibleOptions
Defines the options of the visible interface on the screen.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册