Project: titanium
Issue TIMOB-4521: Android: Natively Compiled JS Modules
h1. Feature Support natively compiled JavaScript modules like we do on iOS. h2. 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: {code:title=assets/ti.jsmod.js} exports.createBox = function() { return Ti.UI.createView({ width: 100, height: 100, backgroundColor: 'red' }); }; {code} 3. Drop the below in example/app.js: {code:title=example/app.js} var window = Ti.UI.createWindow({ backgroundColor: 'white' }); window.add(require('ti.jsmod').createBox()); window.open(); {code} 4. Enjoy your luscious red rectangle h2. 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. h3. Associated Helpdesk Ticket http://appc.me/c/APP-487811
Story points: 2