Closed AD7six closed 13 years ago
IMHO now should not host any javascript files, simply allow the dev to host it (and thus allow anykind of minified and merge version).
+1 for not hosting. It's really easy even for noobs to just put another <script src>
line, or for more experienced to use dynamic loaders (requirejs, scriptjs, whatever consistent to their apps...). It would free nowjs from reimplementing dynamic loader and from responding to issues bound to browsers quirks.
The ticket description is perhaps a bit misleading - I wrote it before the patch.
Do either of you have a comment on the patch (which simply allows you to do whatever you want) as opposed to the ticket description.
Perhaps it's not obvious but
<script src="socket-plus-node-plus-myapp.min.js"></script>
would be pointing at userland code, not a file served by now.js. If you want to do that now, you cannot include the served now.js file without modifying it (which is a chore to maintain) as it still requests socket.io.js by itself.
@AD7six, @dvv
I merged this but changed dependencies
from an object to array of objects so we can still check to see if the dependency is already loaded without introducing the inefficiency of having to count the number of dependencies in the object manually or the use of ES5 Object.keys
Let me know if theres anything else I can do in this area
Looks good to me - concern addressed :]
Right now, there is one http request for now.js - which in turn makes one http request for each dependency, there is only one dependency, but that makes 2 http requests, and they are not served minified.
It would be more flexible if the now.js file served to clients was minified, and was self sufficient, this would allow users to include this file into their own build process such that http requests are reduced to a minimum.
So.. with this patch you can now do this:
Or, more importantly, this: