5 ms·
I wish Javascript has an easy to use unified library/module system. Something like, require "http://ajax.googleapis.com/js/sha1.1.3.1" In the browser, the
by ww520 16y ago
I wish Javascript has an easy to use unified library/module system. Something like,
require "http://ajax.googleapis.com/js/sha1.1.3.1"
In the browser, the browser would download and cache the the library and all its dependencies. For the server side, the server environment would download and cache the library and its dependencies in the same way.
Edit: Ha, a reply was deleted so fast that I didn't have a chance to reply to it. To clarify, Sha1.1.3.1 was meant to be an example of a library, not the SHA digest of a library, though that would be a nice feature. Also "require" should be a feature of the language, not using the html <script> tag so be able to work in the server environment.
- deleted 16y ago[deleted]
- mckoss 16y agoIf library writers were to use CommonJS Modules (i.e. just use require() and exports), we'd be most of the way there. Require.js and AMD still feel like they are not appropriate in all scenarios (e.g., I really don't want or need a "loader" in simple single page applications). This is my suggestion for a very light weight way of using CommonJS Modules in the browser which is agnostic about how your scripts are loaded. http://github.com/mckoss/namespace http://github.com/mckoss/namespace