only return an error when trying to load a different version of the JSAPI
See original GitHub issueCurrently, 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:
If the script hasn’t already loaded, I think we want to piggy back on the original onload
call.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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).
Also, I’m fairly certain that this line:
https://github.com/Esri/esri-loader/blob/ff9989bdc42cfce8a3f30a2a977f45fa818317f1/src/esri-loader.ts#L34
Needs to be guarded with an
if (callback)
check like we do here:https://github.com/Esri/esri-loader/blob/ff9989bdc42cfce8a3f30a2a977f45fa818317f1/src/esri-loader.ts#L52-L57