From 1886f7533427a3cbc322b574bb8af5973f25d560 Mon Sep 17 00:00:00 2001 From: dy_study Date: Tue, 3 Jan 2023 04:37:03 +0000 Subject: [PATCH] =?UTF-8?q?IssueNo:#I5MMIY=20Description:=E4=BD=8E?= =?UTF-8?q?=E5=86=85=E5=AD=98=E7=9B=91=E5=90=AC=E5=9B=9E=E8=B0=83=E8=B5=84?= =?UTF-8?q?=E6=96=99=E6=96=B0=E5=A2=9E=20Sig:SIG=5FApplicaitonFramework=20?= =?UTF-8?q?Feature=20or=20Bugfix:Feature=20Binary=20Source:No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dy_study Change-Id: Idcb2f40513f0f424dc66d84f244b93bd99410d25 --- ...js-apis-application-environmentCallback.md | 20 +++++++++++++++++-- ...is-inner-application-applicationContext.md | 3 +++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-environmentCallback.md b/zh-cn/application-dev/reference/apis/js-apis-application-environmentCallback.md index 76b63aba6a..10d9df8fce 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-application-environmentCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-environmentCallback.md @@ -1,6 +1,6 @@ # @ohos.application.EnvironmentCallback (EnvironmentCallback) -EnvironmentCallback模块提供应用上下文ApplicationContext对系统环境变化监听回调的能力,包括onConfigurationUpdated方法。 +EnvironmentCallback模块提供应用上下文ApplicationContext对系统环境变化监听回调的能力,包括onConfigurationUpdated、onMemoryLevel方法。 > **说明:** > @@ -29,8 +29,21 @@ onConfigurationUpdated(config: Configuration): void; | -------- | -------- | -------- | -------- | | config | [Configuration](js-apis-application-configuration.md) | 是 | 变化后的Configuration对象。 | +## EnvironmentCallback.onMemoryLevel + +onMemoryLevel(level: number): void; + +注册系统内存基线水平变化监听后,在系统内存基线水平变化时触发回调。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | level | [MemoryLevel](js-apis-application-abilityConstant.md#abilityconstantmemorylevel) | 是 | 表示当前内存的基线水平。 | + **示例:** - ```ts import Ability from "@ohos.application.Ability"; @@ -45,6 +58,9 @@ export default class MyAbility extends Ability { onConfigurationUpdated(config){ console.log("onConfigurationUpdated config:" + JSON.stringify(config)); }, + onMemoryLevel(level){ + console.log("onMemoryLevel level:" + level); + } } // 1.获取applicationContext let applicationContext = globalThis.applicationContext; diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md index 0b4e15087c..0030a1c5eb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md @@ -155,6 +155,9 @@ export default class MyAbility extends Ability { onConfigurationUpdated(config){ console.log("onConfigurationUpdated config:" + JSON.stringify(config)); }, + onMemoryLevel(level){ + console.log("onMemoryLevel level:" + level); + } } // 1.获取applicationContext let applicationContext = globalThis.applicationContext; -- GitLab