Select to view content in your preferred language

Unable to override fetchTile() in WebTileLayer.createSubclass

1153
4
Jump to solution
12-13-2022 11:13 PM
AriefAbuBakar
New Contributor

Hi, I can no longer override fetchTile() in WebTileLayer.createSubclass() after I upgrade the ES module from version 4.24.* to version 4.25.*. It is no longer call the fetchTile() function. I tried the CDN version from https://js.arcgis.com/4.25/ but its working fine

 

0 Kudos
1 Solution

Accepted Solutions
YannCabon
Esri Contributor

Like @AndyGup said, it's a regression. If you override `fetchTile()` I'd suggest to extend `BaseTileLayer` https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BaseTileLayer.html which is better suited for extensibility.

View solution in original post

4 Replies
AndyGup
Esri Regular Contributor

Hi @AriefAbuBakar  it's very possible that your code was working accidentally. You need to use the "extends" keyword when building subclasses with ES modules: https://developers.arcgis.com/javascript/latest/implementing-accessor/#create-a-simple-subclass. It can be challenging when overriding API functionality because properties, methods and patterns within the underlying API Class are subject to change.

// Psuedo-example using @arcgis/core ES modules
class ExampleWebTileLayer extends WebTileLayer {
   constructor(properties?:any) {
      super(properties);
   }
   . . . 
}

 

0 Kudos
AndyGup
Esri Regular Contributor

Update - this looks like a regression at 4.25, thanks for reporting. We've opened an issue to fix it.

YannCabon
Esri Contributor

Like @AndyGup said, it's a regression. If you override `fetchTile()` I'd suggest to extend `BaseTileLayer` https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BaseTileLayer.html which is better suited for extensibility.

AndyGup
Esri Regular Contributor

@AriefAbuBakarthis is now fixed and will be available at 4.26. You can test it today by installing the latest 'next' build:

npm i @arcgis/core@next

 

0 Kudos