Connecting Tech Pros Worldwide Forums | Help | Site Map

library of practical JavaScript examples

Manne
Guest
 
Posts: n/a
#1: Jul 18 '06
I'm looking for a library of practical JavaScript examples. Can you
recommend any?
Thanks for your time.


Matt Kruse
Guest
 
Posts: n/a
#2: Jul 18 '06

re: library of practical JavaScript examples


Manne wrote:
Quote:
I'm looking for a library of practical JavaScript examples. Can you
recommend any?
Could you be more vague?

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com


Kevin Darling
Guest
 
Posts: n/a
#3: Jul 19 '06

re: library of practical JavaScript examples



Manne wrote:
Quote:
I'm looking for a library of practical JavaScript examples. Can you
recommend any?
Depends. Are you experienced or just starting out with the language.
If the latter, try looking though the examples at the bottom of this
page:

http://irt.org/script/script.htm

Otherwise, you'll need to be more specific as to what kind of examples
you're looking for... some sites specialize.

Kev

Dr John Stockton
Guest
 
Posts: n/a
#4: Jul 19 '06

re: library of practical JavaScript examples


JRS: In article <1153239860.785630.301870@s13g2000cwa.googlegroups .com>
, dated Tue, 18 Jul 2006 09:24:20 remote, seen in
news:comp.lang.javascript, Manne <manne@merseymail.composted :
Quote:
>I'm looking for a library of practical JavaScript examples. Can you
>recommend any?
No.

Be warned : many such are old and contain amateurish coding.

Be particularly wary of those which allow almost anyone to contribute
almost anything without applying quality control.

For example, one such site contains code obviously copied (without
permission) from my site; but it has been so carelessly copied as to be
of little use as it stands.

When using libraries, remember that the whole of a page, and of the
include files that it uses, must in general be transmitted to the
reader, who may be on a radio or dial-up link. Therefore, use the sort
of library that allows you substantially to select, as an author, only
code which will be executed, and avoid the sort which provides only vast
multi-purpose chunks.

Watch out also for those who code for one specific version of one
browser.

--
© 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.
Matt Kruse
Guest
 
Posts: n/a
#5: Jul 20 '06

re: library of practical JavaScript examples


Dr John Stockton wrote:
Quote:
Therefore, use the
sort of library that allows you substantially to select, as an
author, only code which will be executed, and avoid the sort which
provides only vast multi-purpose chunks.
Two points:

1) In many cases, you can't determine which code will be executed. You can
often only determine which code can _possibly_ be executed.

2) If 5 different pages each use 50% of a 10k "multi-purpose chunk" of code,
it is better to deliver the 10k chunk once and let the browser cache it (10k
total download) vs. delivering 5k of page-specific code 5 times (25k total
downloaded).

I favor writing smaller "multi-purpose chunks" of compacted code, and having
the page select which ones it needs to include. Then you can properly
benefit from caching, include only the small libs which you actually need on
the page, and have a single lib which doesn't have to be cut up and
delivered in smaller chunks.

Further, the creation of "multi-purpose chunks" facilitates code sharing and
reuse (see my sites below) while code written by dissenting authors is often
not shared for others to benefit from.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com


Manne
Guest
 
Posts: n/a
#6: Jul 20 '06

re: library of practical JavaScript examples


Sorry that was a bit vague. I do have some knowledge of programming and
web development. I've read the core guide and feel I could have a go
messing around with other peoples examples.
I was looking for something like this http://rebol.org/ where people
can upload examples of there JS work. The site makes it easy to search
for stuff you might be interested in.

Dr John Stockton
Guest
 
Posts: n/a
#7: Jul 20 '06

re: library of practical JavaScript examples


JRS: In article <e9mtuo01fq9@news4.newsguy.com>, dated Wed, 19 Jul 2006
22:40:01 remote, seen in news:comp.lang.javascript, Matt Kruse
<newsgroups@mattkruse.composted :
Quote:
>Dr John Stockton wrote:
Quote:
>Therefore, use the
>sort of library that allows you substantially to select, as an
>author, only code which will be executed, and avoid the sort which
>provides only vast multi-purpose chunks.
>
>Two points:
>
>1) In many cases, you can't determine which code will be executed. You can
>often only determine which code can _possibly_ be executed.
True, which is why I included "substantially". And "be executed" must
of course include all accesses.

It is bad, for example, to import a complete
function DateObjectFromString(Str, WhichOfVeryManyFormats)
into a page which will only use a single hard-coded value for the second
argument.

<URL:http://www.merlyn.demon.co.uk/js-date4.htm#Genl contains such a
function, but much of the functionality is provided in chunks marked
//optional paragraph
Quote:
>2) If 5 different pages each use 50% of a 10k "multi-purpose chunk" of code,
>it is better to deliver the 10k chunk once and let the browser cache it (10k
>total download) vs. delivering 5k of page-specific code 5 times (25k total
>downloaded).
If all five pages will be fetched. But the longer it takes for the
first page to be fetched, the more likely the reader is to give up and
go elsewhere.

--
© 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.
Matt Kruse
Guest
 
Posts: n/a
#8: Jul 21 '06

re: library of practical JavaScript examples


Dr John Stockton wrote:
Quote:
It is bad, for example, to import a complete
function DateObjectFromString(Str, WhichOfVeryManyFormats)
into a page which will only use a single hard-coded value for the
second argument.
If the function is only a few k, then it is certainly not bad. Far better
than including a typical image in a web page.
Quote:
Quote:
>2) If 5 different pages each use 50% of a 10k "multi-purpose chunk"
>of code, it is better to deliver the 10k chunk once and let the
>browser cache it (10k total download) vs. delivering 5k of
>page-specific code 5 times (25k total downloaded).
If all five pages will be fetched. But the longer it takes for the
first page to be fetched, the more likely the reader is to give up and
go elsewhere.
Don't be dramatic. Many pages have 50k or more of images on them. People
don't leave.
Including 10k, 20k, 30k, or more of cache-able javascript is certainly no
worse, and I've never known anyone to actually abandon a site because of
reasonable-size javascript code being delivered to the browser.

--
Matt Kruse
http://www.JavascriptToolbox.com
http://www.AjaxToolbox.com


Closed Thread


Similar JavaScript / Ajax / DHTML bytes