[GIS] Does an event get fired after a Layer has finished rendering in Openlayers 3

eventsiosjavascriptopenlayersopenlayers-2

I am rendering about 27000 Markers in different layers on a mapview. Everything works fine on fast devices.

I have a problem on older devices (like the iPad3). When i hide one layer and set another layer to visible = true, it takes several seconds for the change to take affect on the mapview. The mapview is frozen in this time and any user interaction is delayed until the cluster layer has finished rendering. It would be better for me to show a loading popup and wait until the view has finally finished rendering.

Is there any event which gets fired after the rendering on the mapview has finished and how can I connect to it?

Best Answer

I found another question (register event "loadend" on layer) with one answer which lead me to the right event:

vectorLayer.on('postcompose', function(event) {
    if (vectorLayer.getVisible()) {
         doSomething();   
    }
});

The method doSomething(); is now called when the corresponding vector layer was completely rendered on the Canvas.