News for hackers. Stuff that matters.
Re:I've never made a public API before. Feedback on this one? by IgorPartola on Wednesday June 16, 2010 @02:02PM (#1436428)
Don't do this:

  var oldonload = window.onload;
Try to avoid touching the global namespace. At most register one object in it: HelpBubble. Use callbacks for the init, open, close, and clicked events. Look at how jQuery does it.

These are too long:

  HelpBubble.API.setText()
  HelpBubble.API.setMenuStyle()
  HelpBubble.API.setButtonStyle()
I would use:

  HelpBubble.API.text()
  HelpBubble.API.menuStyle()
  HelpBubble.API.setButtonStyle()
Passing it nothing should return the current value (for the latter two it should return objects). Setting it should take either objects or strings.

Also, do you expect to only have one instance of these at a time? If not, your API might not work very well.

Re:I've never made a public API before. Feedback on this one? by dannyr on Wednesday June 16, 2010 @02:33PM (#1436523)
JQuery does the same.

$("#element").html($("#element").html() + custom_html);

Re:I've never made a public API before. Feedback on this one? by spicyj on Wednesday June 16, 2010 @04:31PM (#1436926)
Can't you just type $("#element").append(custom_html)?
Re:I've never made a public API before. Feedback on this one? by IgorPartola on Wednesday June 16, 2010 @03:00PM (#1436621)
Yes, and I very much like that API. It's concise which is a huge win when you have to read that code later.