Category Archives: Client side

I decided to write a little article to discourage an unfortunately common pattern in Node.JS modules (and browser JavaScript, to a lesser extent) that can boil down to these two examples:

// A:
function myFunction () {
  if (somethingWrong) {
    throw 'This is my error'
  }
  return allGood;
}

and

// B: async Node.JS-style callback with signature `fn(err, …)`
function myFunction (callback) {
  doSomethingAsync(function () {
    // …
    if (somethingWrong) {
      callback('This is my error')
    } else {
      callback(null, …);
    }
  });
}

In both cases, passing a string instead of an error results in reduced interoperability between modules. It breaks contracts with APIs that might be performing instanceof Error checks, or that want to know more about the error.

Read more

For those of us who didn’t make it, I’ve compiled a list of slides + blog posts from the JSConf 2010 Track A speakers

Alex Russell – “Google Chrome Frame”
Post: http://alex.dojotoolkit.org/
Slides: http://alex.dojotoolkit.org/10/jsconf/gcf.html

Francisco Tolmasky – “Socratic: Documentation Done Right”
GitHub: http://github.com/tolmasky/socratic
Slides: ?

Aaron Newton – “Programming To Patterns”
Slides: http://www.slideshare.net/guest2ee5e2c/programming-to-patterns-presentation (not up-to-date)

Jed Schmidt – “A (fab) approach to web apps”
GitHub: http://github.com/jed/fab
Slides: http://www.flickr.com/photos/tr4nslator/sets/72157623883700702/show/

Dmitry Baranovskiy – “Raphaël the Great”
Slides: http://www.slideshare.net/Dmitry.Baranovskiy/raphal-js-conf

Douglas Crockford – “Really, JavaScript?”
?

Tobias Schneider – “Flash is dead, long live Flash!”
GitHub: http://github.com/tobeytailor/gordon
Slides: http://www.slideshare.net/ConfEcho/flash-is-dead-long-live-flash

Makinde Adeagbo – “Primer: Facebook’s 2k of JavaScript to power (almost) all interactions”
Slides: http://www.slideshare.net/makinde/javascript-primer

Steve Souders – “The Best of Steve”
Slides: http://www.slideshare.net/souders/jsconf-us-2010

Jenn Lukas – “JavaScript and Web Standards Sitting in a Tree”
Slides: http://www.slideshare.net/JennLukas/javascript-and-web-standards-sitting-in-a-tree

Ryan Dahl – “Less is More in Node.js”
Slides: http://nodejs.org/jsconf2010.pdf

Billy Hoffman – “JavaScript’s Evil Side”
Slides: ?

John David Dalton – “All you can leet”
Slides: http://www.slideshare.net/johndaviddalton/jsconf-all-you-can-leet

Aaron Quint – “Making Bacon / Making Code”
GitHub: http://github.com/quirkey/sammy
Post: http://www.quirkey.com/blog/2010/04/20/making-baconmaking-code-jsconf-2010/
Slides: http://swinger.quirkey.com/#/preso/aq-jsconf/display/1
Video: http://bit.ly/9j7u3L

Dion Almaer, Ben Galbraith, and Matt McNulty – “The mobile web”
Slides: http://www.slideshare.net/dion/the-mobile-web-2010-jsconf

Over at LearnBoost, I just released Socket.IO, a normalized Socket API that hides the complexity of the realtime transports.

With code as simple as this:

socket = new io.Socket('localhost');
socket.connect();
socket.send('some data');
socket.addEvent('message', function(data){
    alert('got some data' + data);
});

you’ll be leveraging:

Read more

Big update for my dear jQuery users. I’m rolling out TextboxList for jQuery 0.4 with these updates:

  • [FEATURE] Autocompletion with on-demand server querying
  • [ENHANCEMENT] All classes moved to $. to avoid global namespace pollution. Please make sure to prepend $. to TextboxList if you are upgrading from an older version:

       new $.TextboxList('#element');
    
  • [FEATURE] Easier jQuery-friendly initialization like this:

       $('#element').textboxlist({options});
    

    However, if you still need to access the TextboxList instance to call additional methods (like add), you’ll have to continue to use new $.TextboxList

  • [BUGFIX] GrowingInput now works in noConflict mode

  • [BUGFIX] Fix for GrowingInput to handle special characters and correctly calculate the input length.
  • [BUGFIX] Fix for support of multiple addKeys
  • [BUGFIX] Fix for focus problem when TextboxList gains focus through focusing an editable input
  • [BUGFIX] Autocomplete search term is now trimmed (thanks Mike Feng)
  • [BUGFIX] Fix for when the max option is used
  • [BUGFIX] Fix for unique = true and autocomplete.

As usual, head to the project page for download.