Extend an esri class
See original GitHub issueHi Guys,
Any ideas on how to extend a class? Previously using imports I would just do the following for non-accessor and accessor classes.
import ScaleBarViewModel from "esri/widgets/ScaleBar/ScaleBarViewModel";
import SimpleRenderer from "esri/renderers/SimpleRenderer";
import asd from "esri/core/accessorSupport/decorators";
export class ScaleBarViewModelExtended extends ScaleBarViewModel {
// implementation
}
@asd.subclass("FixRenderer")
export class FixRenderer extends asd.declared(SimpleRenderer) {
// implementation
}
I know I can create the extended class outside of the project and then import the js in using dojo config, but there’s some cases where having the extended class inside of the project is definitely preferable if not necessary (shared interfaces, project specific logic etc…) I’m using Angular 6.1.3 if that makes a difference.
Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:12 (4 by maintainers)
Top Results From Across the Web
Getting started with class extensions
Class extensions are java extension classes that are developed using ArcObjects application programming interfaces (APIs) and deployed to ArcGIS.
Read more >Correctly Extend a Class: Constructor
I'm looking for guidance with how to properly extend a class with respect to its constructor. All of this is in typescript.
Read more >Open feature class with extension in Pro?
Solved: We have feature classes with ArcGIS 10.x vintage feature class extensions. Is it possible to open them in ArcGIS Pro?
Read more >Extending ArcGIS Survey123 | Esri Training Video
View your course activity, schedule, and wish list. ... Continue courses in progress and view completions. ... Attend instructor-led classes, MOOCs, ...
Read more >How to extend MapView class?
I'm trying to create a custom class extending the MapView class in a React application using the arcgis/core package.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I created a Stackblitz for anyone wanting to see how to extend the TileLayer using the solution provided. Extending WebTileLayer
For my case we needed to override the getTileUrl method, to reverse the row. In order for this to work just supply a valid layer urlTemplate.
In case anyone else comes across this - I’ve had to change how I subclass esri modules as I found out the above method won’t work when building using aot.
Now wrap the subclass in an outer class and expose it through a function call. This get’s around the need for the
await import()
call (which wasn’t working in aot), but still allows the required modules to be loaded at runtime.To use the subclass