1# MissionListener 2 3The **MissionListener** module defines the listeners used to observe the mission status. The listeners can be registered by using [registerMissionListener](js-apis-application-missionManager.md#missionmanagerregistermissionlistener). 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9## Modules to Import 10 11```ts 12import missionManager from '@ohos.app.ability.missionManager'; 13``` 14 15**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 16 17| Name | Type | Mandatory| Description | 18| ----------- | -------- | ---- | ------------------------------------------------------------ | 19| onMissionCreated | function | No | Called when the system creates a mission. | 20| onMissionDestroyed | function | No | Called when the system destroys the mission.| 21| onMissionSnapshotChanged | function | No | Called when the system updates the mission snapshot.| 22| onMissionMovedToFront | function | No | Called when the system moves the mission to the foreground.| 23| onMissionLabelUpdated<sup>9+</sup> | function | No | Called when the system updates the mission label.| 24| onMissionIconUpdated<sup>9+</sup> | function | No | Called when the system updates the mission icon.| 25| onMissionClosed<sup>9+</sup> | function | No | Called when the system closes the mission.| 26 27**Example** 28```ts 29import missionManager from '@ohos.application.missionManager'; 30 31let listener = { 32 onMissionCreated: function (mission) { 33 console.log('onMissionCreated mission: ' + JSON.stringify(mission)); 34 }, 35 onMissionDestroyed: function (mission) { 36 console.log('onMissionDestroyed mission: ' + JSON.stringify(mission)); 37 }, 38 onMissionSnapshotChanged: function (mission) { 39 console.log('onMissionSnapshotChanged mission: ' + JSON.stringify(mission)); 40 }, 41 onMissionMovedToFront: function (mission) { 42 console.log('onMissionMovedToFront mission: ' + JSON.stringify(mission)); 43 }, 44 onMissionLabelUpdated: function (mission) { 45 console.log('onMissionLabelUpdated mission: ' + JSON.stringify(mission)); 46 }, 47 onMissionIconUpdated: function (mission, icon) { 48 console.log('onMissionIconUpdated mission: ' + JSON.stringify(mission)); 49 console.log('onMissionIconUpdated icon: ' + JSON.stringify(icon)); 50 }, 51 onMissionClosed: function (mission) { 52 console.log('onMissionClosed mission: ' + JSON.stringify(mission)); 53 } 54}; 55let listenerid = missionManager.registerMissionListener(listener); 56``` 57