Where to Submit JavaScript Library

V

vunet

If I'd like to submit my own JavaScript library to distribute it to
other people who may find it useful, what are good sites for that?
Also, should I protect myself under some license?
Thank you.
 
B

Ben Crowell

vunet said:
If I'd like to submit my own JavaScript library to distribute it to
other people who may find it useful, what are good sites for that?

http://openjsan.org
http://freshmeat.net/

Also, should I protect myself under some license?

Depends on what you mean by "protect myself." If you want to go with
an open-source license, there's GPL or BSD (which comes in various
flavors).

http://en.wikipedia.org/wiki/Free_software_license

The GPL is typically what you use if you want to make sure that
when other people modify your code, or incorporate it into their
own software, and then redistribute it, they have to put it under
the same license you used. In other words, it won't just end up
as an invisible part of some proprietary product, without credit
to you, payment to you, or acknowledgement of your contribution.

BSD is more permissive. It's what you use, for example, if you're
trying to convince people to adopt a certain standard widely.
 
V

vunet

http://openjsan.orghttp://freshmeat.net/

 > Also, should I protect myself under some license?

Depends on what you mean by "protect myself." If you want to go with
an open-source license, there's GPL or BSD (which comes in various
flavors).

http://en.wikipedia.org/wiki/Free_software_license

The GPL is typically what you use if you want to make sure that
when other people modify your code, or incorporate it into their
own software, and then redistribute it, they have to put it under
the same license you used. In other words, it won't just end up
as an invisible part of some proprietary product, without credit
to you, payment to you, or acknowledgement of your contribution.

BSD is more permissive. It's what you use, for example, if you're
trying to convince people to adopt a certain standard widely.

Thank you very much for your informative answer. I also researched and
it looked like MIT license could fit my needs. What would be the
difference? And, to use any license do I need to do anything other
than saying it's using such and such license? Is there any legal part
I must do?
Thank you again.
 
B

Ben Crowell

vunet said:
Thank you very much for your informative answer. I also researched and
it looked like MIT license could fit my needs. What would be the
difference?

http://en.wikipedia.org/wiki/Mit_license#Comparison_to_other_licenses

It's a permissive license. If all you care about is that you want a
permissive license, then typically it's a good idea to choose the
most common license, to help prevent the unnecessary proliferation
of licenses. By that criterion, BSD would be better. A good reason
to use an unusual license would be if you expect your code to be
used with some other code that's under that license.
And, to use any license do I need to do anything other
than saying it's using such and such license? Is there any legal part
I must do?

Just put comments in the code saying it's under that license, and
also say that on the web page from which people would be downloading
it. The license gives other people rights that they wouldn't otherwise
have had. If they don't know about the license, or don't agree to it,
then they simply have to abide by copyright law. It is *not* necessary
to make them click through on the license or anything like that.

If you're in the US, copyright registration is not required in order
to get the copyright. The copyright is yours as soon as you write the
code. However, filing a copyright form does make it possible for you
to sue for more than actual damages if someone violates your copyright.
In most cases, it's not worth the effort and cost, in my opinion.
 
T

Thomas 'PointedEars' Lahn

vunet said:
Thank you very much for your informative answer. I also researched and
it looked like MIT license could fit my needs. What would be the
difference? And, to use any license do I need to do anything other
than saying it's using such and such license? Is there any legal part
I must do?

That is usually specified by the license(s) under which you distribute your
software. If the license(s) make no specification(s), it depends on how
"protected" you want to be.

This has nothing to do with ECMAScript-based programming -- it is
*off-topic* here. There are newsgroups for discussing legal issues
informally, and there is a whole profession dealing with such issues;
pay (attention to) them instead.

<http://www.jibbering.com/faq/faq_notes/clj_posts.html#ps1OToc>


PointedEars
 
B

Ben Crowell

Thomas said:
That is usually specified by the license(s) under which you distribute your
software. If the license(s) make no specification(s), it depends on how
"protected" you want to be.

This has nothing to do with ECMAScript-based programming -- it is
*off-topic* here. There are newsgroups for discussing legal issues
informally, and there is a whole profession dealing with such issues;
pay (attention to) them instead.

<http://www.jibbering.com/faq/faq_notes/clj_posts.html#ps1OToc>

Aw, don't snarl at the newbies. If you're not interested in this thread,
just don't follow it.
 
D

Dr J R Stockton

In comp.lang.javascript message <6d402e83-2289-451b-8b98-d7cfbaeb78de@u1
0g2000vbd.googlegroups.com>, Fri, 8 May 2009 12:03:47, vunet
If I'd like to submit my own JavaScript library to distribute it to
other people who may find it useful, what are good sites for that?
Also, should I protect myself under some license?

Posting anonymously from a gmail account gives little confidence - do
you yet have a reputation to hide?

Before you publish your material in some sort of repository, you ought
to get it reviewed; it may be full of egregious coding, it may be
superfluous, etc. For that, you can post a personal URL here.

Be warned, however; if you get a response from PE it will probably be
factually exact (except when he writes faster than he can think), but it
will be unpleasant in tone.
 
M

MC

Ben Crowell said:
Aw, don't snarl at the newbies. If you're not interested in this thread,
just don't follow it.

Trolls can't help it...the smell of fresh tender victims... The squeals of
pain as they gnash and grind and tear apart every word...
 
V

vunet

In comp.lang.javascript message <6d402e83-2289-451b-8b98-d7cfbaeb78de@u1
0g2000vbd.googlegroups.com>, Fri, 8 May 2009 12:03:47, vunet


Posting anonymously from a gmail account gives little confidence - do
you yet have a reputation to hide?

Before you publish your material in some sort of repository, you ought
to get it reviewed; it may be full of egregious coding, it may be
superfluous, etc.  For that, you can post a personal URL here.

Be warned, however; if you get a response from PE it will probably be
factually exact (except when he writes faster than he can think), but it
will be unpleasant in tone.

--
 (c) John Stockton, nr London UK. replyYYWW merlyn demon co uk Turnpike6.05.
 Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
 Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> :  about usage of News.
 No Encoding. Quotes precede replies. Snip well. Write clearly. Mail noNews.

Thanks. If anyone has time to look at it, I'd appreciate. Please don't
be very judgmental - it's my first one. If it's a useless piece of
cr*p - just say "All right, not that bad for the first time".
Thank you for everyone who provides any input.

vunet.us/test/api.html
 
J

Jeremy J Starcher

Thanks. If anyone has time to look at it, I'd appreciate. Please don't
be very judgmental - it's my first one. If it's a useless piece of cr*p
- just say "All right, not that bad for the first time". Thank you for
everyone who provides any input.

vunet.us/test/api.html

There are a number of people who question the whole idea of putting
together "a library" as a one-size fits all. I'm sure some of them will
weigh in. IMHO, if one is going to do a library, one should do it as
'modular' as possible, with a tiny core and then make it easy to include
just the APIs that one needs.


Comments on code:
Lose this in its entirety. Browser sniffing is obsolete and
untrustworthy at best, and failing in "interesting" ways at worst.

Browser : {
isIE: !!(window.attachEvent && !window.opera),
isIE6: !!(window.attachEvent && !window.opera && !
window.XMLHttpRequest),
isOpera: !!window.opera,
isSafari: navigator.userAgent.toLowerCase().indexOf
('safari') > -1,
isGecko: navigator.userAgent.indexOf('Gecko') > -1 &&
navigator.userAgent.indexOf('KHTML') == -1,
isDOM: !!document.getElementById
},


And loose this function too.
Firstly, the name $ for a function is just a bad name. (Common, but
still bad.)
$ : function(id){
return document.getElementById(id);
},



What does this function even do?
Poorly named. This function is actually
getElementByIdAndIfItDoesNotExistThenCreateIt.

IMO, any function that begins with "get___" should not have any side
effects. If a value is not found, then return something like 'null' or
'undefined'

In addition, you are not getting HTML. In fact, this function has /
nothing/ to do with HTML. It does, however, return an element node,
which may at one point been created with HTML.

getHTML : function(tagName, id){
if(id != null){
var obj = this.$(id);
if(obj) return obj;
}
var obj = document.createElement(tagName);
if(id != null) obj.id = id;
return obj;
},


Again, a poorly named function. See notes on HTML above.

Secondly, this function can be written without try/catch. Between the
performance issues of try/catch and its lack of universal support, its
use should be kept to a minimum.

removeHTML : function(id){
var obj = this.$(id);
if(obj) try{ obj.parentNode.removeChild(obj); }catch(e){}
},



The 'util.getQueryString' function:
Check the c.l.js archives for 'serialize forms' and the 'Code Worth
Recommending' project. Your code does not handle checkboxes, radio
buttons or multi-select combo boxes.



Your 'addEvent' code is broken.
Read:
< http://www.quirksmode.org/blog/archives/2005/08/addevent_consid.html >
< http://www.quirksmode.org/blog/archives/2005/09/addevent_recodi.html >


I didn't look into any of the tooltip code or Ajax code.



There is no consensus about augment Native (as opposed to host) objects
like String, Number and Arrays. Some do it freely, others avoid doing it
under any circumstance. Do you understand the side effects of doing so,
and how it might impact someone who is using this library?

Lastly, your code does no feature detection to determine what host
methods do or do not exist, and thus may fail in a very ungraceful way.

Yes, there are browsers in use that do not support try/catch and

Search the c.l.js archives for 'Code Worth Recommending Project' and read
about isHostMethod and family.
 
V

vunet

There are a number of people who question the whole idea of putting
together "a library" as a one-size fits all.  I'm sure some of them will
weigh in.  IMHO, if one is going to do a library, one should do it as
'modular' as possible, with a tiny core and then make it easy to include
just the APIs that one needs.

Comments on code:
Lose this in its entirety.  Browser sniffing is obsolete and
untrustworthy at best, and failing in "interesting" ways at worst.

        Browser : {
                isIE: !!(window.attachEvent && !window.opera),
                isIE6: !!(window.attachEvent && !window.opera && !
window.XMLHttpRequest),
                isOpera: !!window.opera,
                isSafari: navigator.userAgent.toLowerCase().indexOf
('safari') > -1,
                isGecko: navigator.userAgent.indexOf('Gecko') > -1 &&
navigator.userAgent.indexOf('KHTML') == -1,
                isDOM: !!document.getElementById        
        },

And loose this function too.
Firstly, the name $ for a function is just a bad name.  (Common, but
still bad.)  
  $ : function(id){
        return document.getElementById(id);
    },

What does this function even do?
Poorly named.  This function is actually
getElementByIdAndIfItDoesNotExistThenCreateIt.

IMO, any function that begins with "get___" should not have any side
effects.  If a value is not found, then return something like 'null' or
'undefined'

In addition, you are not getting HTML.  In fact, this function has /
nothing/ to do with HTML.  It does, however, return an element node,
which may at one point been created with HTML.

        getHTML : function(tagName, id){
                if(id != null){
                        var obj = this.$(id);
                        if(obj) return obj;
                }
                var obj = document.createElement(tagName);
                if(id != null) obj.id = id;
                return obj;
        },

Again, a poorly named function.  See notes on HTML above.

Secondly, this function can be written without try/catch.  Between the
performance issues of try/catch and its lack of universal support, its
use should be kept to a minimum.

        removeHTML : function(id){
                var obj = this.$(id);
                if(obj) try{ obj.parentNode.removeChild(obj); }catch(e){}
        },

The 'util.getQueryString' function:
Check the c.l.js archives for 'serialize forms' and the 'Code Worth
Recommending' project.  Your code does not handle checkboxes, radio
buttons or multi-select combo boxes.

Your 'addEvent' code is broken.
Read:
<http://www.quirksmode.org/blog/archives/2005/08/addevent_consid.html>
<http://www.quirksmode.org/blog/archives/2005/09/addevent_recodi.html>

I didn't look into any of the tooltip code or Ajax code.

There is no consensus about augment Native (as opposed to host) objects
like String, Number and Arrays.  Some do it freely, others avoid doing it
under any circumstance.   Do you understand the side effects of doing so,
and how it might impact someone who is using this library?

Lastly, your code does no feature detection to determine what host
methods do or do not exist, and thus may fail in a very ungraceful way.

Yes, there are browsers in use that do not support try/catch and

Search the c.l.js archives for 'Code Worth Recommending Project' and read
about isHostMethod and family.

I really appreciate. Very valuable suggestions.
 
D

Dr J R Stockton

In comp.lang.javascript message <6c069b74-8c44-46e2-a7d1-c8ff23ab7a31@n4
g2000vba.googlegroups.com>, Fri, 15 May 2009 08:40:04, vunet

Evidently the hint in my sig about newsgroup usage was insufficient.
Thanks. If anyone has time to look at it, I'd appreciate. Please don't
be very judgmental - it's my first one. If it's a useless piece of
cr*p - just say "All right, not that bad for the first time".
Thank you for everyone who provides any input.

vunet.us/test/api.html

Number.prototype.toDecimals - Gives bad result for 3e22, infinity.
Causes error (in FF3) if x is null or undefined. In it, I think n
should be set to +n, to avoid unnecessary conversions; and an upper
bound to n might help. Using a while loop might be more efficient than
using recursion. You should have read an older version of the FAQ.

Code would be easier to read if indented by 2 spaces instead of each
tab, and lines generally no longer than about 72 characters.

Variable cookedDate will be in error if the span crosses a Summer Time
change. Method toGMTString is deprecated.

'fontSize : "0.9em"' - font size should not be forced below user's
preference without good reason.

Method endsWith : consider using a RegExp argument, to give something of
wider applicability.

<http://vunet.us/home.asp> fails W3 validation, 26 errors, 2 warnings.
IMHO it also is in breach of ADA, though you may not care about that.
The clock in the status bar is localised (and pointless); you should
follow ISO 8601. The page rightly has an international telephone
number; but it does not have an international postal address. That is
thoughtless and/or ill-mannered. The smallness of the contact feedback
box is not justified by your enforcement of a microscopic font.

<http://www.knowledgebase.vunet.us/web/days.html> :
<script language="JavaScript"> is deprecated.
Rather than 7 ifs, that could better use a switch; it should use a
literal array.
Since that page is code, the font should be fixed-pitch.

<http://www.knowledgebase.vunet.us/web/checkemail.html> :
checkEmail("(e-mail address removed)") returns false.
checkEmail("[email protected]") returns false.

Never recommend here anything not in agreement with the newsgroup FAQ
without a sufficiently good reason.


It's a good idea to read the newsgroup c.l.j and its FAQ. See below.
 
P

Peter Michaux

Dr" J R Stockton said:
Posting anonymously from a gmail account gives little confidence - do
you yet have a reputation to hide?

Are you posting anonymously from "merlyn.demon.co.uk"?
Before you publish your material in some sort of repository, you ought
to get it reviewed; it may be full of egregious coding, it may be
superfluous, etc. For that, you can post a personal URL here.

That is a good suggestion. There is plenty of bad JavaScript available
for download already.
Be warned, however; if you get a response from PE it will probably be
factually exact (except when he writes faster than he can think), but it
will be unpleasant in tone.

PointedEars isn't the only rude one around. Unfortunately the rude
ones seem to have very useful things to contribute. It is worth
wadding through the bravado for the informative bits.

Peter
 
P

Peter Michaux

Yes, there are browsers in use that do not support try/catch and

Do you happen to have a (partial) list? The last one I know of was
Randy Webb's cell phone a few years ago. I believe his cell phone did
an auto update and did have try/catch after that.

Even if there are browsers that do not support try/catch, that doesn't
mean it should be avoided in all (or even many) cases. I use try/catch
without worrying when programming for the general web.
Search the c.l.js archives for 'Code Worth Recommending Project' and read
about isHostMethod and family.

I summarized what I learned from that discussion in the following two
articles.

http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting

http://peter.michaux.ca/articles/cross-browser-widgets

Peter
 
J

Jeremy J Starcher

Do you happen to have a (partial) list? The last one I know of was Randy
Webb's cell phone a few years ago. I believe his cell phone did an auto
update and did have try/catch after that.

Yea, my PDA. A Palm Tungstun W.

Can't remember what the browser is called, and I don't have the unit here
with me. (I quit using it for a browser after getting an Eee 701)
 
D

David Mark

Yea, my PDA.  A Palm Tungstun W.

Can't remember what the browser is called, and I don't have the unit here
with me.  (I quit using it for a browser after getting an Eee 701)

Probably NetFront. Same as Randy Webb had in his phone and also found
in the PS3 (though likely a newer version.) IE4 is on the list as
well, but far less of a concern.

The biggest issue with try-catch is that it is a lousy error handling
mechanism. It is also often used as a crutch by programmers who can't
figure out why their code throws exceptions.
 
P

Peter Michaux

The biggest issue with try-catch is that it is a lousy error handling
mechanism.  It is also often used as a crutch by programmers who can't
figure out why their code throws exceptions.

Other programmers problems are not a valid reason to avoid using try-
catch.

Peter
 
D

David Mark

Other programmers problems are not a valid reason to avoid using try-
catch.

Yes. It's not a reason, but a red flag. The main thing is that your
handler has no idea what the error was. (!)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,102
Messages
2,570,645
Members
47,245
Latest member
ShannonEat

Latest Threads

Top