Can i use viewer.extend with class not function, because Cesium throw exception VM5099:5 Uncaught TypeError: Cannot call a class as a function.
And i should use Class.show not Class.prototype.constructor
Can i use viewer.extend with class not function, because Cesium throw exception VM5099:5 Uncaught TypeError: Cannot call a class as a function.
And i should use Class.show not Class.prototype.constructor
Hello,
I'm trying to expand the viewer [viewer.extend] using classes ES6.
I have seen many examples and realized that mixins created as a function of. How correct create mixins?
Hello,
viewer.extend expects the first parameter to be a function that adds additional functionality to the viewer. It calls this function with the viewer and the options that you passed in as the second paramater.
Take a look at the viewerCesiumInspectorMixin for an example: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Widgets/Viewer/viewerCesiumInspectorMixin.js#L30
If you wanted to use a class, you could create a helper function to do something like
MyClass.extendViewer = function(viewer, options) {
viewer.myClass = new MyClass(viewer, options)
}
viewer.extend(MyClass.extendViewer, options)
``
Best,
Hannah
Thank you, but problem what context is lost. When pass my function in viewer.extend context `this` in MyClass is lost