AnsweredAssumed Answered

When does getMap() return a valid map?

Question asked by epaitz-esristaff Employee on May 26, 2017
Latest reply on Jun 13, 2017 by agup-esristaff

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

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.