bago2k4 / cljs-dynamic-resources

Dynamically load JavaScript and CSS resources from your ClojureScript code.
Eclipse Public License 1.0
2 stars 1 forks source link

late-loading html? #2

Open daonsh opened 7 years ago

daonsh commented 7 years ago

Hi,

I know it may be impossible using this lib, but since it explicitly says it's only for css and js I wanted to ask - if I have some HTML (which includes some resources such as tags) and would like to delay loading it until after all cljs have been loaded, is there a simple solution to do that?

Thanks

bago2k4 commented 7 years ago

I would use something like cljs-http Client to load the data (ajax request) and then store or manipulare or inject it in the page. It depends on how you want to use these resources but to load that code you can use simple ajax GET requests. Also with jQuery it should be pretty quick. This library aim to inject <script> and <style> tags in the page so they are automatically recognised, loaded and interpreted by the browser and ready to use when necessary. Also it provides some useful callback to know when the code is loaded.