Mobileweb Module Development?

You must Login before you can answer or comment on any questions.

Is there a timeframe for when we can develop modules for Mobileweb?

I'm particularly interested in being able to wrap a <canvas> element to use for drawing. I've checked the nightly builds and it appears there is something there, but I'm wondering when this ability will be generally available?

Thanks!

2 Answers

Accepted Answer

It's working now in the nightly CI builds! :)

However, the nightly builds are not considered "stable". You will need to use the titanium.py Python command line scripts from the Titanium mobilesdk folder to create the module. After writing your module, you can run the build.py to compile the module.

The compiled module is zipped up. You can unzip this file and manually install the module into your Titanium mobilesdk path or in your specific app's module directory (not created by default, sibling to Resources).

Your module code will need to look like this:

define(["Ti/_/declare", "Ti/UI/View"], function(declare, View) {
    return declare("MyCanvasView", View, {
        domType: "canvas",
        constructor: function(params) {
            // init
        }
    });
});
Then in your app.js, just:
var myCanvasView = require("name of your module");
var win = Ti.UI.createWindow();
win.add(new myCanvasView({ /* params go here */ }));
win.open();
There are no docs on how to do all this. :(

— answered 12 months ago by Chris Barber
answer permalink
6 Comments
  • So.... 11 months later, are there any docs now?

    — commented 2 weeks ago by Josiah Hester

  • Unfortunately, no. :(

    I recently revisited the state of Mobile Web modules and it's pretty bad. Things are very half baked. There are some serious issues that I have to sort out. For example, things fall apart if the module contains more than one file. require() doesn't work properly in modules.

    I'm trying to get Mobile Web modules working for the 3.2 release, but it's unfortunately a really low priority, so we'll see how far I get.

    — commented 2 weeks ago by Chris Barber

  • Yeah Ive found myself spending a lot of time in the codebase and editing it as needed.... If I can get this canvas module to work I will post back with results.

    — commented 2 weeks ago by Josiah Hester

  • Show 3 more comments

Magnificent! This is a spectacular start!

Thanks for the help Chris! (Bear Hugs Chris)

Your Answer

Think you can help? Login to answer this question!