Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-4521

Android: Natively Compiled JS Modules

    Details

    • Story Points:
      2

      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:

      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:

      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

        Attachments

          Activity

            People

            • Assignee:
              billdawson Bill Dawson
              Reporter:
              dtoth Dawson Toth
            • Watchers:
              26 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Source Code