[thelist] Proper Way of Separating 'Library' Files in JS

Matt Warden mwarden at gmail.com
Wed Jun 15 21:30:52 CDT 2005


thelist,

I am creating a bit of a 'library' in Javascript. In doing so, I
needed to create another data structure. If I were using, say, PHP, I
would include() or require() this data structure's file within the
file that is using it. However, to my knowledge, there's no way to do
this with an external javascript. Currently, I am doing this:

<script type="text/javascript" src="js/lib/hashtable.js"></script>
<script type="text/javascript" src="js/lib/mylibrary.js"></script>

But, this is a bit odd, as anyone using my library would need to make
sure they are including lib/hashtable.js as well, or things would not
go well. However, since the code in hashtable.js is general and not
specific to my library, I feel like it would be equally odd to include
it within my library itself.

Thoughts?

Thanks,

-- 
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.


More information about the thelist mailing list