I am using the JavaScript SDK 3.18 and I am relatively new to the SDK. I am using Angular 2 and TypeScript and I am trying to create my own layer that extends the ArcGISDynamicMapServiceLayer and I need access to that map so I can listen to the extent-changed event. I have tried the following in my TypeScript.
export class MyDynamicMapServiceLayer extends ArcGISDynamicMapServiceLayer {
constructor(url: string, options? ArcGISDynamicMapServiceLayerOptions) {
super(url, options);
this.on('load', (event) => {
//Check this.getMap() here
this.getMap();
this._map;
this['_map']
event.target.getMap();
event.layer.getMap();
});
}
}I have tried to get a reference to the map from the load event several different ways without success. What is the correct way to either get a reference to the map or to listen to the extent changed (so I can get access to the current LOD) from within a custom layer? Any suggestions would be appreciated.
Thanks,
-eric