0

I am trying to avoid throwing errors when the widget is opened and closed too fast (doesn't get a chance to fully load, so the process gets interrupted and throws an error). However, I can't seem to find a way to detect when the widget is done loading. I have already tried using on(elevationProfileWidget, 'load', function () {isLoaded = true;}), but it seems like the 'load' event is fired way before the widget is finished loading, because whenever I open and close it quick enough, the following error is thrown:

TypeError: Cannot read property 'setAttribute' of undefined
    at Object._createTooltip (ElevationProfile.js:22)
    at Object.<anonymous> (ElevationProfile.js:12)
    at init.js:64
    at c (init.js:104)
    at e (init.js:104)
    at b.Deferred.resolve.callback (init.js:106)
    at Object.<anonymous> (ElevationProfile.js:13)
    at init.js:64
    at c (init.js:104)
    at e (init.js:104) "TypeError: Cannot read property 'setAttribute' of undefined
    at Object._createTooltip (https://js.arcgis.com/3.27/esri/dijit/ElevationProfile.js:22:23)
    at Object.<anonymous> (https://js.arcgis.com/3.27/esri/dijit/ElevationProfile.js:12:383)
    at http://js.arcgis.com/3.27/init.js:64:337
    at c (http://js.arcgis.com/3.27/init.js:104:393)
    at e (http://js.arcgis.com/3.27/init.js:104:182)
    at b.Deferred.resolve.callback (http://js.arcgis.com/3.27/init.js:106:10)
    at Object.<anonymous> (https://js.arcgis.com/3.27/esri/dijit/ElevationProfile.js:13:310)
    at http://js.arcgis.com/3.27/init.js:64:337
    at c (http://js.arcgis.com/3.27/init.js:104:393)
    at e (http://js.arcgis.com/3.27/init.js:104:182)"

Granted that the widget still disappears and is still disposed, I'd rather not have these errors be thrown and have underlying issues later on, and it doesn't seem like 'ready' can be used in place of 'load'. This error doesn't get thrown if I let the widget sit for a couple seconds before closing it.

Your Answer

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

Browse other questions tagged or ask your own question.