Skip to content

Mamoo released as open source

by Topper on March 15th, 2009

I just put the Motionbox Advanced Model Observer Observer (Mamoo) up on Github. It's a light-weight (13k), but fairly powerful framework for javascript built on top of Prototype and the Motionbox EventHandler.

It's fairly well documented and has a full suite of specs written in ScrewUnit.

Mamoo let's you stop thinking about the "glue code" you need on a client-side app - and start thinking like "when this happens, I want this to happen." - Event driven architecture in JS.

Checkout the readme for a romp through most of the features.

To whet your appetite, here's a really small, but useful app written with Mamoo.

JavaScript:
  1. Message = MBX.JsModel.create("Message");
  2.  
  3. MBX.MessageView = MBX.JsView.create({
  4.     model: Message,
  5.    
  6.     onInstanceCreate: function (message) {
  7.         var li = this.buildLi(message);
  8.         $("message_list").insert(li);
  9.     },
  10.    
  11.     buildLi: function (message) {
  12.         var li = new Element("li", { id: message.primaryKey() });
  13.         li.update(message.get('body'));
  14.         li.updatesOn(message, "body");
  15.         return li;
  16.     }
  17. });
  18.  
  19. // This will add the ui element
  20. var message = Message.create({ body: "this is my body!" });
  21.  
  22. // and if you change body, the ui will automatically update as well
  23. message.set('body', "some other body");

Assuming you have an ol with the id of "message_list" in your html page, now everytime you create a message, it'll get populated into the DOM.

I also put together a 15minute screencast that gives you a quick demo of a bunch of the features of Mamoo.

Nifty?

6 Comments
  1. Would you consider building using this as part of a combined framework with JavaScriptMVC and archetype? We’ve been trying to get people together with similar ideas together to make a unified framework.

    Let me know what you think.

  2. Just sent you an email. I think the answer is “yes” with a “but…” :-)

  3. Cool stuff Topper! Gonna experiment with mamoo a bit …

Trackbacks & Pingbacks

  1. Ajaxian » Maboo: Client-side MVC from Motionbox
  2. Mamoo: Client-side MVC from Motionbox | Guilda Blog
  3. A collection of links about JavaScript and the MVC development pattern - paulcarvill.com

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS