Suggestion - Module Loader for non-UMD style usage of ESRI classes & objects
See original GitHub issueBuilt and use this in a production app on top of esri-loader to easily access parts of the API.
https://gist.github.com/davidpiesse/19060cf21f90f4a1460aa33954b4b957
Instead of always having to
esriLoader.loadModules(['esri/views/MapView', 'esri/WebMap'])
.then(([MapView, WebMap]) => {
let web_map = new WebMap({ ... });
}
...
now you can
await esri.loadModules([
'esri/Map',
'esri/views/MapView',
],true)
let map_view = new MapView({
map: map,
spatialReference: 102100
})
I use it a lot and usually wrap calls in promises etc. to know when a object is then ready.
It doesn’t re-download if something is already loaded in and auto assigns names to the classes (so esri/views/MapView is MapView) rather than the long winded UMD style method which means you need to keep them in order.
This is also makes it super easy to only request a module when you need it inline with your code
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Build with ES modules | ArcGIS Maps SDK for JavaScript 4.25
ES modules are an official, standardized module system for working with modern JavaScript that has been adopted by all the major browsers. The...
Read more >Esri/esri-loader: A tiny library to help load ArcGIS API ... - GitHub
A tiny library to help load ArcGIS API for JavaScript modules in non-Dojo applications - GitHub - Esri/esri-loader: A tiny library to help...
Read more >Esri Training
Learn the latest GIS technology through free live training seminars, self-paced courses, or classes taught by Esri experts. Resources are available for ...
Read more >Loader of the Things: One Library to Load Them All
If your ArcGIS web application uses any other module loader besides the Dojo loader (i.e. webpack, Rollup.js, etc.) ...
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
👍 here’s a working
await
implementation https://github.com/Esri/angular-cli-esri-map/blob/master/src/app/esri-map/esri-map.component.ts#L66Fair enough. I’ll close this then 😅 One of my main reasons for this method was I preferred opinionated code in this context and having to organise and remember the order of declarations was a pain.