Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4521] Android: Natively Compiled JS Modules

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-05-24T15:54:50.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sRelease 2.0.2, Release 2.1.0, Sprint 2012-10 Core, Sprint 2012-11 Core
ComponentsAndroid
Labelscore, qe-port
ReporterDawson Toth
AssigneeBill Dawson
Created2011-06-29T08:26:10.000+0000
Updated2012-06-14T17:18:00.000+0000

Description

Feature

Support natively compiled JavaScript modules like we do on iOS.

Example Module

The following steps create a compiled module that you could distribute as a zip on iOS. Once implemented, the same process would work on Android. 1. Create a new module for Android: titanium create --platform=android --type=module --name=jsmod --id=ti.jsmod --android=/path/to/android-sdk 2. Drop the below in assets/ti.jsmod.js:
exports.createBox = function() {
    return Ti.UI.createView({
        width: 100, height: 100,
        backgroundColor: 'red'
    });
};
3. Drop the below in example/app.js:
var window = Ti.UI.createWindow({ backgroundColor: 'white' });
window.add(require('ti.jsmod').createBox());
window.open();
4. Enjoy your luscious red rectangle

Workaround

Until this feature is available, you can always distribute just the JS file. Developers can utilize it in its un-compiled state, although your code isn't protected from prying eyes.

Associated Helpdesk Ticket

http://appc.me/c/APP-487811

Comments

  1. Willem Peters 2011-12-27

    Any news on this? -- Cheers
  2. David Knell 2012-01-05

    Seems like a lot of people are watching this. Is there anything else we can do to push this forward?
  3. David Knell 2012-01-30

    How about a little love for Android here, please...
  4. Mark Burggraf 2012-02-09

    I'd like to see this as well, so we can maintain parity between iOS and Android for our modules.
  5. David Knell 2012-03-05

    Is there any chance we will see this in 1.9?
  6. David Knell 2012-03-24

    Please...
  7. Bill Dawson 2012-05-10

    Dependency on TIMOB-9010 because a) it's in the same sprint; b) it affects how the javascript is packaged
  8. Bill Dawson 2012-05-21

    Pull request: https://github.com/appcelerator/titanium_mobile/pull/2237
  9. Carl Orthlieb 2012-05-22

    Looks like the pull request was merged and closed 11 minutes ago.
  10. Bill Dawson 2012-05-22

    Yeah, I think because it's an absolute requirement for 2.0.X immediately, we'll delay the resolution of the ticket. The cherry-pick is going to be nasty and require another round of testing.
  11. Bill Dawson 2012-05-22

    2.0.X backport pull request ready: https://github.com/appcelerator/titanium_mobile/pull/2251
  12. Bill Dawson 2012-05-23

    Needs to reopen because Python 2.6+ specific code is in there :( Need to convert that code to be compatible with Python 2.5 because that's what is packaged in Studio on Windows. Sorry, I didn't know the relevant syntax was new in 2.6.
  13. Bill Dawson 2012-05-23

    Pull requests for conversion of Python 2.6+ code to Python 2.5: 2_0_X: https://github.com/appcelerator/titanium_mobile/pull/2266 master: https://github.com/appcelerator/titanium_mobile/pull/2267
  14. Shyam Bhadauria 2012-06-12

    Adding environment info - Tested with Titanium SDK: 2.1.0.v20120608174150 Tested with Titanium Studio: 2.1.0.201206081630 Device - Android 2.2 and Android 2.3.3 Android Runtime - V8

JSON Source