Hacker News new | past | comments | ask | show | jobs | submit login

Yep, this is the race condition that the author was referring to. RequireJs also let's you express these dependencies, but will block behind the cssdom due to the way it injects. Actually, I made a little library which let's you manage dependencies with script async or defer, and can be considered an alternative to the authors (neat) solution. https://github.com/bohdyone/adm.js



Curious question: Can you explain a bit more on "will block behind the cssdom due to the way it injects"

As far as I know, requireJS doesn't do XHR requests and evals. That sounds ugly. I think it dynamically injects a script tag and loads the module. I maybe wrong.

Either way, how's it a blocking one?

So, the only thing that makes fetchInject, differ from requireJS is the non-blocking way. Is my understanding correct?


This article by an engineer at Google explains it pretty well. My own testing has shown the same results. https://www.igvita.com/2014/05/20/script-injected-async-scri...


also wondering about the cssom comment. I can confirm that requirejs works by injecting <script> tags - <script async> to be precise. requirejs' api isn't promise based, but that's mostly an aesthetic concern.

btw you seem to imply that requirejs blocks - what do you mean by that?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: