Your listener id (must be unique for all layer events)
Your listener function
// Each time a tree element visibility is changed, will display the new visibility
// in the console
JMap.Event.Layer.on.visibilityChange(
   "custom-visibility-change",
   params => {
     console.log(`Layer element id="${params.layerId}" visible="${params.visibility}"`)
   }
)
JMap.Event.Layer.on.visibilityChange
This event is triggered when a tree element visibility changed.