harmony 鸿蒙Window Manager Subsystem Changelog

  • 2023-06-24
  • 浏览 (575)

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 鸿蒙Readme

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

harmony 鸿蒙File Management Subsystem Changelog

harmony 鸿蒙Input Method Framework ChangeLog

0  赞