Monday, March 1, 2010

chainable generic javascript objects

yeah...is a mouth full but it is insanely good stuff.



function GenericObj(){
var ChainableObject = function(){ return new ChainableObject.fn.init();};
ChainableObject.fn = ChainableObject.protoype = {};
ChainableObject.fn.init = function(){};
ChainableObject.fn.init.prototype = ChainableObject.fn;
return ChainableObject;
}



My buddy and co-worker Mahdi (don't worry, the site has been under construction forever...i just needed somewhere to link) are currently working on a jQuery toolkit that will be module based. jQuery ToolKit (yeah, that too is under construction). This little nugget is in the toolkit and more gold like this you can expect to find.