silikonedge.blogg.se

Runjs license
Runjs license












runjs license

Some environments, like Adobe AIR do not allow eval() and most developers are taught that eval() is evil and should be avoided.

runjs license

It can also be slower than plain script tag loading. Using synchronous XHR is not very friendly for new developers or people who want ease of debugging across browsers. However, I was mostly concerned with something that worked well in the browser, and that meant needing a function wrapper so we could use script tags. I originally wanted something that would work with CommonJS modules, but those modules seemed to be structured assuming a synchronous module loader, which is possible in server-side JavaScript environments. I also liked explicitly passing the dependent modules as arguments to the function definition, since it allowed linting tools like JSLint to be more effective. I believe RequireJS is more generic, since YUI seems to use labels for their modules that do not directly correspond to file paths. YUI 3's use() function is also very similar to require, and use()'s API (but not code) also informed RequireJS' structure. I fleshed out some of the details for RequireJS (then called RunJS) on the dojo-contributors list, and Mike Wilson originally pushed for a more generic loader that could load plain files as well as allow for different contexts. The Dojo community seemed more amenable to considering a function wrapper, particularly since we are considering a Dojo 2.0 that can break some APIs. This can cause errors if the module references a dependency as part of the module's definition. In 2009, David Mark suggested that Dojo use document.write() to load modules before the page loads to help with that issue, but it meant required dependencies would not load until after the current module executes. However, the sync XHR loader has other issues, like making debugging harder. Because of the more complex i18n and requireIf requirements and the existence of many dojo modules already out in the world, I did not feel like the Dojo community would consider writing modules with function wrappers manually. So I created the xdomain loader that required a build step to inject function wrappers similar to what RequireJS uses, but more complex, due to i18n bundle loading and dojo.requireIf behavior. However, the XHR loader couldn't load Dojo modules from other domains because of the same-origin restrictions. The normal dojo loader used to use synchronous XMLHttpRequest (XHR) calls.














Runjs license