LayerList event when layer visibility is changed

509
1
05-01-2019 03:30 PM
Status: Open
DavidSchontzler
New Contributor III

Please add an event to the LayerList widget so we can listen for changes to layer visibility. For example, in our applications, we want to save the layer configuration whenever something changes. We expected that the LayerList would notify us of changes to layer visibility, but that is currently not the case.

I expect it would look something like so:

const list = new LayerList({ view });

list.on('layer-visibility', (layer) => {
  if (layer.visible) doSomething();
  else doSomethingElse();
});‍‍‍‍‍‍
1 Comment
AlexGilvarry1

This would be very helpful