Monday, May 26, 2008

Meta classes and jQuery

I am currently experimenting with making Joose the perfect match to everyones favorite JavaScript library jQuery.
One result is basic Widget class that makes it possible to link a Joose class to a jQuery selector:
Class("Button", {
isa: Widget,

has: {
message: {
init: "hello world"

events: {
click: function () {
dblclick: function () {
alert("please only click once :)")

You can now instantiate buttons like this:
var buttons = new Button(".button")

Only for the interested here is the source code of the meta class WidgetMetaclass and the abstract class Widget:

/* Meta class for widgets */
Class("WidgetMetaclass", {
isa: Joose.Class,

has: {
events: {
is: "rw",
init: function () { return {} }

override: {

// make events from declaration available as instance var of the meta class
builders: function () {
var orig = this.SUPER();
return Joose.O.extend({
events: function (events) {
}, orig)

Class("Widget", {
meta: WidgetMetaclass,
isAbstract: true,
has: {
"$": {}, // the jQuery objects
selector: {
is: "rw"

methods: {
initialize: function () {

var j;
if(arguments.length > 0) {
j = jQuery.apply(jQuery, arguments);
else {
j = this.getSelector()
this.$ = j;

var me = this
var meta = this.meta;
var events = meta.getEvents();
// put my events into my jQuery object
Joose.O.each(events, function (func, name) {
var bound = function () { func.apply(me, arguments) }
var obj = me;

Tuesday, May 13, 2008

Version 0.04 of Joose released

Version 0.04 of Joose was just released. Excerpt from the change log:
  • Battle hardened in production environments
  • Roles can now include method modifiers that are applied to classes that do the role
  • Experimental implementation of type constraints and type coercions
  • More correct meta behavior in the second meta level and beyond
  • Many more tests
The download is here.

Thursday, May 8, 2008

New Release coming up

The weather is really great in Hamburg right now, but a new release of Joose in long overdue and long ready :) I'll do some IE Testing on the weekend and the release should happen on monday.

Wednesday, May 7, 2008

Work on complex Example

Joose development is currently all about cutting out rough edges and proving the usability of the framework in real world situations.

Most of the work is going into an example that is implementing those features of Microsoft Visio as a browser application that I use for user interface prototyping. The application is written using Joose and jQuery.

I'll post a link to the example application here shortly.