importAbilityfrom'@ohos.application.Ability'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")}onWindowStageCreate(windowStage){// Main window is created, set main page for this abilityconsole.log("[Demo] MainAbility onWindowStageCreate windowStage="+windowStage)//globalThis.windowStage = windowStage//globalThis.abilityStorage = this.storageglobalThis.abilityContext=this.contextwindowStage.setUIContent(this.context,"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")}};