With Dojo gone, some questions on 4.25 and ES modules

11-30-2022 01:30 PM
Occasional Contributor

I’ve been playing with ES Modules in the ArcGIS API for JavaScript 4.25. Dojo is gone, so I have some questions.

  1. Is there an equivalent for “dojo/text!./somehtml.html”?
  2. Is there an equivalent for dojoConfig = {cacheBust: true}? It’s very helpful to always get fresh resources so that users get code changes right away without needing to clear their cache. Is there a way to cacheBust ES modules?
  3. Is there an equivalent for “connect.disconnect”? I used this to disconnect any tools that needed to click the map. Is there a way in 4.25 to disconnect the view.hitTest?

The more I work with ES modules, I may have more questions. But these are three so far.


0 Kudos
1 Reply
Esri Regular Contributor

Hi @DanielWebb, good questions, they related to both the AMD and ES modules:

1. No. You can use esri/request or use native fetch directly to load HTML as a string into your app

2. This can be handled through industry-standard patterns such as using Etags. You can also set the cacheBust option in esri/request, but this is a different implementation from dojo, instead of adding a param, it tells fetch to make a conditional request. If you always want to cacheBust, then you can use a requestInterceptor with the url set to null.

3.You can remove event listeners natively. If you are using an "on" listener, you can remove those using the APIs remove() method.