18 Jul

Belated project announcements: Malt, CouchDB-xd

Malt.js

Last year I released Malt.js, an asynchronous JavaScript dependency manager. It’s basically a packaging system that lets you declare modules and include them on-demand.

Here’s an example:

Malt.module('facebox', 'js/facebox.js', 'css/facebox.css', function() {
  // initialize facebox
});

Malt.require('facebox', function() {
  // execute after all resources loaded, initialized
});

I think the syntax is particularly nice and minimal, but, admittedly, I haven’t used this library on any production apps. I came to conclude that it’s more beneficial to front-load cached scripts before a page renders than to load them as-you-go — at least for the kind of web applications I’ve been building. It would probably fit in better with a single-page application (i.e. GMail); if that’s your game, I encourage you to take a look.

Aside: If you’re just interested in loading scripts asynchronously, I recommend looking at LABjs. It’s a project that has basically figured out the optimal way to load scripts in parallel, adjusting for every browser.

CouchDB-xd

CouchDB-xd is a cross-domain AJAX library for CouchDB that provides a standard CRUD interface for Couch’s database and document APIs. It basically gives you the power to read and write to Couch databases from JavaScript, anywhere on the web. I think it makes for some interesting application possibilities, made easier with Couch.io and other “cloud” Couch hosts around the corner.

Aside: CouchDB already exposes a JSONP interface for its records (which is largely undocumented), but unfortunately, you’re limited to GET queries, which makes modifying records a no-go.