I have checked this code with OL 3.17.1 and it does work well. However, it does not work with OL 5.3.0. There are two issues.
The way this is used in the code is not accurate, as it could be different within an event handler and in OL 5.3.0, they change it to something else. A better way would be to store a reference to this and use that instead.
There is no longer a method called unByKey(). But, they support un() which works in OL 3.17.1 and also 5.3.0.
The improvement below fixes the code such that it works on both OL 3.17.1 and 5.3.0.
I have however not tested this for versions in between these two. There is also widespread use of unByKey() in the code, which could be replaced with un().
I have checked this code with OL 3.17.1 and it does work well. However, it does not work with OL 5.3.0. There are two issues.
this
is used in the code is not accurate, as it could be different within an event handler and in OL 5.3.0, they change it to something else. A better way would be to store a reference tothis
and use that instead.unByKey()
. But, they supportun()
which works in OL 3.17.1 and also 5.3.0. The improvement below fixes the code such that it works on both OL 3.17.1 and 5.3.0.I have however not tested this for versions in between these two. There is also widespread use of
unByKey()
in the code, which could be replaced withun()
.