Kranium a lightweight MVC framework for Titanium Mobile

Kranium is a lightweight MVC framework for JavaScript application. Its main aim is to simplify Titanium Mobile development.

Adam Renklint gave a post on getting started for Kranium.

Some advantages Kranium brought over than original Titanium mobile are as following.

  • Build interface elements grouped into tree structure using K as a root namespace, instead of using old ways, we add one label instance, one button instance, and then add one by one into windows. In old way, we cannot know exactly the orders the elements placed, until at the end we add one by one to the window, but using Kranium we can manage it well using the tree structure. (Refer here…)
  • Easily extends the elements instance. It provides an extendable class structure that is able to create our own UI interface element easily. For example, we want to create a label that showing our login status automatically when we log in and log out from our application. We can extend the original label type UI element, and register own custom events to inform the login status and update to the label UI element. (Refer here…)
  • Live updating UI modules. I haven’t tried but it sounded amazing and powerful. It said, built from Livetanium, you are able to see the changes of UI elements immediately on the simulator and the actual device whenever you made changes to the UI files or stylesheets. It is amazing, because currently I only can make change to the UI element to the JavaScript file and then click stop and start the simulator and see the changes and it takes some times, you know, when you design the UI layout, it’s frustrating. At the back end, it implemented Kranium watcher, that is able to monitor the file changes and pipe the changes through Node.JS server to the simulator or actual device in real time and you can see the real time updates of UI element on the simulator or actual device. It said it currently worked well in iOS only. (Refer here…)
  • Simple selector engine. Like jQuery, you can use the selector like $(".label .button").text("test") to modify the attributes of the UI elements. You can even chain the statements to include the other modification. Influenced from jQuery, Kranium also provides other utility methods such as .each(), .filter(), .find(), .parents() with the selector defined to modify the UI elements easily.

Kranium is very powerful as you can see, it made developments of Titanium Mobile easier and even quicker. But, I hoped that we can have a WYSIWYG editor in order to show the UI elements what exactly look liked inside the IDE without running it in the simulator or actual device.

Author: fyhao

Jebsen & Jessen Comms Singapore INTI University College Bsc (Hon) of Computer Science, Coventry University

One thought on “Kranium a lightweight MVC framework for Titanium Mobile”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.