From what I've understood ol.Object classes have observable properties which are detailed here: http://openlayers.org/en/v3.8.1/apidoc/ol.Object.html
This makes sense to me, however what is not detailed here is how to dispatch custom events on classes that extend the ol.Object.
In my current application I create controls that extend the ol.Control class and by definition are ol.Object's. So I can listen to changes to properties that I have set using ol.Object's get/set methods. I've also been able to see how events are dispatched by doing the following for example:
objectOne.dispatchEvent('fired');I could then listen to his event and run a function accordingly:
objectOne.on('fired', function(e) { alert('fired!'); });In my code at present I am performing these operations and everything is ok, providing I use the debug version of OL3. As soon as I change to the compiled version dispatchEvent is no longer available.
Why is this method hidden in the production version? Should I be using a different method to fire my own custom events? It seems strange at present that you can listen for events and property changes but you cannot fire your own custom events when using the compiled version of OL3
أكثر...
This makes sense to me, however what is not detailed here is how to dispatch custom events on classes that extend the ol.Object.
In my current application I create controls that extend the ol.Control class and by definition are ol.Object's. So I can listen to changes to properties that I have set using ol.Object's get/set methods. I've also been able to see how events are dispatched by doing the following for example:
objectOne.dispatchEvent('fired');I could then listen to his event and run a function accordingly:
objectOne.on('fired', function(e) { alert('fired!'); });In my code at present I am performing these operations and everything is ok, providing I use the debug version of OL3. As soon as I change to the compiled version dispatchEvent is no longer available.
Why is this method hidden in the production version? Should I be using a different method to fire my own custom events? It seems strange at present that you can listen for events and property changes but you cannot fire your own custom events when using the compiled version of OL3
أكثر...