question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

only return an error when trying to load a different version of the JSAPI

See original GitHub issue

Currently, we throw return an error when the user calls bootstrap more than once, regardless of:

  • whether or not the first script tag is still loading
  • the first script tag is for the same version of the JSAPI as subsequent script tags

Currently this is causing problems in ember-esri-loader tests (https://github.com/Esri/ember-esri-loader/pull/27). I can work around those problems in that library, but I am wondering if it actually makes sense to return an error in all the above conditions.

I’m pretty sure we want to return an error whenever the user is trying to load a different version of the JSAPI.

If it’s the same version of the JSAPI, and if the script has already loaded we should just call the callback w/ window.require as we do here:

https://github.com/Esri/esri-loader/blob/ff9989bdc42cfce8a3f30a2a977f45fa818317f1/src/esri-loader.ts#L47-L56

If the script hasn’t already loaded, I think we want to piggy back on the original onload call.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tomwaysoncommented, Aug 30, 2017

Also, whenever we return an error b/c a script is already loading/ed, we should also pass that script as the second argument to the callback as a convenience to the caller (I know that would be helpful to me right now as I’m working through how to handle the above errors in ember-esri-loader).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Possible bug with ArcGIS API for JavaScript Locate...
This error is generated only when using the ArcGIS JavaScript API's Locate Button dijit (aka Geolocation Widget) in any web app/webmap in a ......
Read more >
Error Messages | Maps JavaScript API - Google Developers
This page describes the error messages that can be returned by the Maps JavaScript API. The Maps JavaScript API writes error and warning...
Read more >
What's new in Version 3.9 | ArcGIS API for JavaScript 3.42
All layers have a loadError property indicating if an error occurred while trying to retrieve layer metadata. LocateButton.graphicsLayer option to specify the ...
Read more >
"Uncaught SyntaxError: Cannot use import statement outside ...
I got this error because I forgot the type="module" inside the script tag:
Read more >
Apple Pay on the Web Demo
Try it: Display Settings. Use the following tools to try the different display settings on the button shown below: Button Style.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found