1

The typescript code below compiles, but bounds is getting a runtime error suggesting that update is not a known function.

var bounds = self.esriHelper.requireModule('esri/geometry/Extent');
bounds = bounds.update ( -60836536.56026919, -42677544.62462127, 342437.88671754766, 8169589.583117515, self.spatialReference);

This code was originally on version 3.18 of ESRI's Javascript API. I upgraded to 3.32 and added the two lines above to create a map without a basemap

self.map = new Map('map', {
  extent: bounds,
  sliderPosition: 'top-right',
  logo: false
});

I am new to javascript and working on inherited code. I also tried import {Extent} from 'esri/geometry/Extent'; without success.

2

I am not quite sure what is self.esriHelper.requireModule, it seems like an util function to load modules. If that's the case then the return is a class not an object. Extent update function works on an extent object, because it updates the values of the caller, in other words it doesn't work on a class.

You need something like this,

var esriGeometryExtent = self.esriHelper.requireModule('esri/geometry/Extent');
bounds = new esriGeometryExtent( -60836536.56026919, -42677544.62462127, 342437.88671754766, 8169589.583117515, self.spatialReference);

Again, I am supposing that self.esriHelper.requireModule is a function that loads a module, and that it resolves correctly the async logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.