bootstrap-map-js icon indicating copy to clipboard operation
bootstrap-map-js copied to clipboard

Suggestion to not require esri/arcgis/utils unless it is needed

Open tomwayson opened this issue 10 years ago • 2 comments

It would be nice if esri/arcgis/utils was not required unless it was needed (i.e. unless application calls createWebMap()). I've found for a simple application that uses createMap() and then adds a single feature layer, I can shave off ~30kb of JavaScript by commenting out the code that requires esri/arcgis/utils.

This could be done w/o changing the API by using a nested require block inside createWebMap(). I'm not aware of any drawbacks to that.

Just wanted to get other people's thoughts on this idea.

tomwayson avatar Mar 01 '15 16:03 tomwayson

I play with Deferred and Promise to do that https://github.com/tsamaya/bootstrap-map-js/commit/4490cae48cf3475b2d23bf5ed3d9a5662ba70a94

I think the drawback is that loading the esriUtils seems to be visible => loading the webmap seems to be longer.

I don't think it is useful for the demo and the any purpose component, but I is good to know the weight for possible optimisation .

tsamaya avatar Mar 19 '15 23:03 tsamaya

Too bad that it takes longer, b/c this is the kind of thing I had in mind.

@alaframboise and I talked about this issue before DevSummit and agreed to revisit it when re-working this repo to work w/ JSAPI 4.0.

tomwayson avatar Mar 20 '15 04:03 tomwayson