467,117 Members | 1,173 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,117 developers. It's quick & easy.

how to build a library in JS

Hi All,
I am new to javascript and intend to build a custom library. After
saving independent files which contain separate functions, how does one
build the library?

Any help is a great help!! Thanks in advance

Thanks
ananth

Aug 16 '06 #1
  • viewed: 1219
Share:
2 Replies
You can either join all the .js files into one and distribute it, or
the end user will have to include each separate file with a <script
src="..."tag.

If the separate files have dependencies on other files, I would put
them together. I don't think there's any guarantee the browser will
process the .js files in the order they're specified.

Aug 16 '06 #2
JRS: In article <11**********************@b28g2000cwb.googlegroups .com>
, dated Wed, 16 Aug 2006 12:46:02 remote, seen in
news:comp.lang.javascript, bluesky <sa************@gmail.composted :
>I am new to javascript and intend to build a custom library.
Then you are probably trying to run before learning to walk.
After
saving independent files which contain separate functions, how does one
build the library?
With a text editor.

In languages such as Borland Pascal and Delphi, one can include any
amount of library code in a compilation, and only the needed parts will
be included in the final executable. Web Javascript lacks such a
capability, and, as it is repeatedly transmitted over links which may be
slow, a thoughtful page author will be careful to send only what may be
used to his readers.

Your basic library should therefore be like a public library; users take
and use only what they want. It should not be like the traditional
Encyclopaedia, for which if you want to own any particular article
legitimately you need to buy and store the whole work.

Web site authors should package the routines that will be repeatedly
used in a site within one or more "include files", generally according
to topic; and each page should only call for the include files that it
will use.

Remember, though, that include files should be cached locally to the
reader.

Read the newsgroup and its FAQ.
--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/>? JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Aug 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by grunar@gmail.com | last post: by
2 posts views Thread by hubert_s | last post: by
3 posts views Thread by Chuck Conlow | last post: by
7 posts views Thread by SteveB | last post: by
7 posts views Thread by dm_dal | last post: by
4 posts views Thread by P.Kienzle | last post: by
2 posts views Thread by 2b|!2b==? | last post: by
3 posts views Thread by mnjkahn via AccessMonster.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.