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**System capability**: SystemCapability.Ability.AbilityRuntime.Mission 6 7| Name | Type | Mandatory| Description | 8| ----------- | -------- | ---- | ------------------------------------------------------------ | 9| onMissionCreated | function | No | Called when the system creates a mission. | 10| onMissionDestroyed | function | No | Called when the system destroys the mission.| 11| onMissionSnapshotChanged | function | No | Called when the system updates the mission snapshot.| 12| onMissionMovedToFront | function | No | Called when the system moves the mission to the foreground.| 13| onMissionLabelUpdated | function | No | Called when the system updates the mission label.| 14| onMissionIconUpdated | function | No | Called when the system updates the mission icon.| 15| onMissionClosed | function | No | Called when the system closes the mission.| 16 17**Example** 18```ts 19import missionManager from '@ohos.application.missionManager'; 20 21let listener = { 22 onMissionCreated: function (mission) { 23 console.log('onMissionCreated mission: ' + JSON.stringify(mission)); 24 }, 25 onMissionDestroyed: function (mission) { 26 console.log('onMissionDestroyed mission: ' + JSON.stringify(mission)); 27 }, 28 onMissionSnapshotChanged: function (mission) { 29 console.log('onMissionSnapshotChanged mission: ' + JSON.stringify(mission)); 30 }, 31 onMissionMovedToFront: function (mission) { 32 console.log('onMissionMovedToFront mission: ' + JSON.stringify(mission)); 33 }, 34 onMissionLabelUpdated: function (mission) { 35 console.log('onMissionLabelUpdated mission: ' + JSON.stringify(mission)); 36 }, 37 onMissionIconUpdated: function (mission, icon) { 38 console.log('onMissionIconUpdated mission: ' + JSON.stringify(mission)); 39 console.log('onMissionIconUpdated icon: ' + JSON.stringify(icon)); 40 }, 41 onMissionClosed: function (mission) { 42 console.log('onMissionClosed mission: ' + JSON.stringify(mission)); 43 } 44}; 45let listenerid = missionManager.registerMissionListener(listener); 46``` 47