Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-13193] TiAPI: Native JS module: support Ti.include

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2014-03-31T21:56:54.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid, iOS
Labelsandroid, axe, include, ios, js, module
ReporterCarter Lathrop
AssigneeIngo Muschenetz
Created2013-03-25T09:52:58.000+0000
Updated2017-03-22T22:53:04.000+0000

Description

Thanks to TIMOB-9317 we now are able to require submodules inside modules Now it would nice to be able to use Ti.include with module compiled js files.

Test Steps

Module build

Create a new module project for Android/ios with the id com.foo.bar.

Download the attached assets.zip

Unzip assets.zip in the directory of the new module project

Run ant to build the module.

Project

Download the attached tic2043.zip and unzip it.

Import the resulting directory into TiStudio

Run project

Pass:

The test is simple, if you see "woo :)" in the console then it worked!

Attachments

FileDateSize
assets.zip2013-03-25T11:22:55.000+0000677
tic2043.zip2013-03-25T11:22:55.000+00002362468

Comments

  1. Martin Guillon 2013-03-25

    Testing

    Module build

    Create a new module project for Android/ios with the id com.foo.bar. Download the attached assets.zip unzip assets.zip in the directory of the new module project run ant to build the module.

    Project

    Download the attached tic2043.zip and unzip it. Import the resulting directory into TiStudio Run project

    Pass:

    The test is simple, if you see "woo :)" in the console then it worked!
  2. Carter Lathrop 2013-03-25

    This is a new feature request. Changing as such. Thanks for the suggestion, engineering will take a look at it. Regards, Carter
  3. Martin Guillon 2013-03-25

    Sorry you are right, wasnt on purpose :s
  4. Martin Guillon 2013-03-29

    Ok working with that i realised it was trickier than i though. In fact i cant rely on the context to guess where to get the file (assets or native module). It came to light while using the module. My native JS module has a method which will include a file. What you exepct is for the include to be looked for relatively from where the method was called and not relatively to the context. So what i ended up doing is simply to allow include to "look" for module in the same way require does. Ti.include('com.foo.bar/toto.js"); will look for toto.js in the module com.foo.bar (as it exists and is loaded). If you do Ti.include('/toto.js"); or Ti.include('./toto.js"); or Ti.include('toto.js"); inside a module it will always look for the asset (like it was done before). I updated the test case to reflect all that I will post a pull request for that
  5. Martin Guillon 2013-03-29

    Seems that now that it is a TIMOB ticket i cant modify it anymore :s So here is the expected pass [object ComFooBarModule] loaded [INFO] :   test1 from module com.foo.bar [INFO] :   test1 from app [INFO] :   module tested [INFO] :   test1 from app [INFO] :   test1 from module com.foo.bar Now for the assets, they need to be updated as the ones in the description are not good anymore :s you can get them there [assets](https://dl.dropbox.com/u/255893/titanium/assets.zip) [tic2043](https://dl.dropbox.com/u/255893/titanium/tic2043.zip)
  6. Martin Guillon 2013-03-29

    and here is the pull request https://github.com/appcelerator/titanium_mobile/pull/4028
  7. Ingo Muschenetz 2014-03-31

    We have decided that we will be deprecating support to Ti.Include, so we don't want to extend support for this behavior.
  8. Lee Morris 2017-03-22

    Closing ticket as "Won't Fix".

JSON Source