import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';export default class EntryAbility extends UIAbility {onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {}
}
import { UIAbility } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
import { hilog } from '@kit.PerformanceAnalysisKit';const TAG: string = '[EntryAbility]';
const DOMAIN_NUMBER: number = 0xFF00;export default class EntryAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {}onWindowStageCreate(windowStage: window.WindowStage): void {try {windowStage.on('windowStageEvent', (data) => {let stageEventType: window.WindowStageEventType = data;switch (stageEventType) {case window.WindowStageEventType.SHOWN: hilog.info(DOMAIN_NUMBER, TAG, `windowStage foreground.`);break;case window.WindowStageEventType.ACTIVE: hilog.info(DOMAIN_NUMBER, TAG, `windowStage active.`);break;case window.WindowStageEventType.INACTIVE: hilog.info(DOMAIN_NUMBER, TAG, `windowStage inactive.`);break;case window.WindowStageEventType.HIDDEN: hilog.info(DOMAIN_NUMBER, TAG, `windowStage background.`);break;case window.WindowStageEventType.RESUMED: hilog.info(DOMAIN_NUMBER, TAG, `windowStage resumed.`);break;case window.WindowStageEventType.PAUSED: hilog.info(DOMAIN_NUMBER, TAG, `windowStage paused.`);break;default:break;}});} catch (exception) {hilog.error(DOMAIN_NUMBER, TAG,`Failed to enable the listener for window stage event changes. Cause: ${JSON.stringify(exception)}`);}hilog.info(DOMAIN_NUMBER, TAG, `%{public}s`, `Ability onWindowStageCreate`);windowStage.loadContent('pages/Index', (err, data) => {});}onForeground(): void {}onBackground(): void {}
onWindowStageWillDestroy(windowStage: window.WindowStage) {try {if (this.windowStage) {this.windowStage.off('windowStageEvent');}} catch (err) {let code = (err as BusinessError).code;let message = (err as BusinessError).message;hilog.error(DOMAIN_NUMBER, TAG, `Failed to disable the listener for windowStageEvent. Code is ${code}, message is ${message}`);}}onWindowStageDestroy() {}onDestroy() {}
}