Extending CDF

With the collaboration of Will Gorman CDF has now a modularized and extensible library of components that can be extended by users. Using an object oriented approach, the key is to extend the class BaseComponent. Here's the simplest component of them all, the TextComponent:

var TextComponent = BaseComponent.extend({
	update : function() {
		$("#"+this.htmlObject).html(this.expression());
	}
});
			

Having defined this, when CDF reads a component with type="textComponent" it will automatically use the supplied definition. The source code with all the components definition is the best resource for additional information.