harmony 鸿蒙Window Manager Subsystem Changelog
Window Manager Subsystem Changelog
cl.window.1 Change of Window Stage Lifecycle Listener Types
Changed the enumerated listener types of the window stage lifecycle in version 3.2.10.5 and later.
Change Impacts
Application lifecycle listeners developed using FOREGROUND and BACKGROUND in versions earlier than 3.2.10.5 will be invalidated in version 3.2.10.5 and later.
Key API/Component Changes
WindowStageEventType9+
Before change
Name | Value | Description |
---|---|---|
FOREGROUND | 1 | The window stage is running in the foreground. |
BACKGROUND | 4 | The window stage is running in the background. |
After change |Name|Value|Description | |——|—-|———-| |SHOWN|1 |The window stage is running in the foreground.| |HIDDEN|4 |The window stage is running in the background.|
Adaptation Guide
When registering lifecycle listeners, change the foreground and background event types to SHOWN and HIDDEN, respectively.
import Ability from '@ohos.application.Ability';
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
console.log('onWindowStageCreate');
try {
windowStage.on('windowStageEvent', (stageEventType) => {
switch (stageEventType) {
case window.WindowStageEventType.SHOWN:
console.log("windowStage shown");
break;
case window.WindowStageEventType.ACTIVE:
console.log("windowStage active");
break;
case window.WindowStageEventType.INACTIVE:
console.log("windowStage inActive");
break;
case window.WindowStageEventType.HIDDEN:
console.log("windowStage hidden");
break;
default:
break;
}
} )
} catch (exception) {
console.error('Failed to enable the listener for window stage event changes. Cause:' +
JSON.stringify(exception));
};
}
};
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Example Subsystem Changelog
harmony 鸿蒙Ability Framework Changelog
harmony 鸿蒙Account Subsystem Changelog
harmony 鸿蒙ArkUI Subsystem ChangeLog
harmony 鸿蒙Multimedia Subsystem Changelog
harmony 鸿蒙Common Library Subsystem Changelog
harmony 鸿蒙Distributed Data Management Subsystem JS API Changelog
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦