Select to view content in your preferred language

MapView.scale - Accessor set and get - async?

550
2
11-08-2019 09:47 AM
AndreasKunz
Emerging Contributor

Dear all,

recently i came across a strange behaviour of the Esri-JavaScript Api 4.13.
The MapView.scale was set in one method, and then the getter was called in another method. But the value returned was still the old one. I stepped inside the sources to the point where the set and get methods are implemented (Accessor, then MapView) and realised that there is a flag "internallyReady", which, in case of the getter, is used to decide which value to return, the old one or the new one.

I locked up the Api-Docs, but there was not any note about the scale property being asynchronous. To me it seems kind of odd, that a getter/setter is showing this kind behaviour. When is it save to call the getter to receive the value that was actually set?

Am i missing something?

Best regards
Andreas

0 Kudos
2 Replies
UndralBatsukh
Esri Regular Contributor

Hi there, 

You should watch for view.updating property to get the updated scale value. Please look at the Watch for Property changes section in this document.

Hope this helps,

-Undral

0 Kudos
AndreasKunz
Emerging Contributor

Hi Undral,

sorry for answering so late, thanks for the tip! We managed to get around this, but i will keep the updating-property in mind.

Cheers
Schotty

0 Kudos