Archetype to ease developments

/**
 * Constructor
 */
initialize: function () {
	$("bodyContent")
	  .observe("click", this.createDate);
},
/**
 * Private method which launch the DateUpdate event
 * with the current date in parameter
 */
_createDate : function () {
	this.fireDateUpdate(new Date());
},
/**
 * Fire a "DateUpdate" event
 */
fireDateUpdate: _,
/**
 * Listen to "DateUpdate" event
 */
onDateUpdate: function(eventName, date) {
	Logger.log(
	  "controller received a date:" + date);
}

A unique mechanism in JavaScript: "MethodBuilders"

  • We don't implement a component, we just describe it
  • Archetype builds the object and improve it with transversal services

Current MethodBuilders additions:

  • Helpful to fire and receive events, in a natural manner
  • Private methods
  • "this" binding on every methods, which provides a real "object like" feeling in Javascript.

Logs!

  • Archetype defines a generic interface for logging
  • You can choose display solution: Firebug, JS alert, directly in the page body, nothing...