Your listener id (must be unique for all layer events)
Your listener function
// Each time a new project is loaded and its layer have also been loaded,
// this method is processed.
JMap.Event.Layer.on.layersChange(
"custom-layers-change",
params => {
console.log("This is the new project layer three", params.layerTree)
}
)
JMap.Event.Layer.on.layersChange
This event is triggered when a new project has been loaded, and when its layers have been loaded too.
If the project has been unloaded, this event is triggered but the provided layerTree is an empty array (in JMap a project has at least one layer).