openlayers-3 在等待时更改光标

openlayers-3 change cursor while waiting

如何在等待某些操作结束时更改光标? 使用下面的代码,光标不会改变。我想我需要刷新,但我不知道如何触发。

map.on('singleclick', function(evt) {
    myfunc(evt); });

myfunc(evt) {
    map.getViewport().style.cursor = 'wait';
    // do some lengthy processing
    map.getViewport().style.cursor = 'pointer';
    }
map.on('singleclick', myfunc);

var myfunc = function(evt) {
    map.getTargetElement().style.cursor = 'wait';
    // do some lengthy processing
    map.getTargetElement().style.cursor = 'pointer';
}

使用getTargetElement()。此外,无需创建匿名函数。