Thursday, January 8, 2009

Joosifying PureMVC

Based on Nickolay's work for Ext I implemented a Joose to PureMVC bridge. PureMVC is a MVC framework that was originally implemented for Flash/ActionScript3 but which has implementations for JavaScript, Java, C# and other languages.

Using the new Joose bridge you can use Joose to build PureMVC applications. You can use Joose's facilities to inherit from the PureMVC base classes and apply Joose-roles to all instances and classes included in PureMVC. The code works on the sample application. There seems to be no test suite in the main repository, so it cant be fully verified.

The bridge code is actually very simple. PureMVC uses a simple JavaScript class framework called objs.js. This framework provides a method called "register" to register classes and a method called "extend" to inherit from a super class. The bridge code overrides these methods. Thus automatically all classes from PureMVC can be turned into Joose classes without any further changes to the actual code of the framework.

You can download the code from the Joose repository. Just replace the file objs.js from the PureMVC download with the file from Joose and you are good to go.
The code was only minimally tested but seems to work. If there is further interest or as soon as I have a work project that uses the framework I'll invest further time in it.
Post a Comment