importAbilityfrom'@ohos.app.ability.UIAbility'exportdefaultclassMainAbilityextendsAbility{onCreate(want,launchParam){// Ability is creating, initialize resources for this abilityconsole.log("[Demo] MainAbility onCreate")globalThis.abilityWant=want;}onDestroy(){// Ability is destroying, release resources for this abilityconsole.log("[Demo] MainAbility onDestroy")}asynconWindowStageCreate(windowStage){console.log("[Demo] MainAbility onWindowStageCreate windowStage="+windowStage)globalThis.windowStage=windowStageglobalThis.abilityContext=this.contextwindowStage.setUIContent(this.context,"MainAbility/pages/index/index",null)}onWindowStageDestroy(){//Main window is destroyed, release UI related resourcesconsole.log("[Demo] MainAbility onWindowStageDestroy")}onForeground(){// Ability has brought to foregroundconsole.log("[Demo] MainAbility onForeground")}onBackground(){// Ability has back to backgroundconsole.log("[Demo] MainAbility onBackground")}};