Hi I am building a iOS app using Appcelerator,
I have a file app.js
and a file webService.js
the file webService.js contains a function x
now from my app.js
file i want to call function x
that is present in the webService.js
file.
I searched a lot but i only found that using html..i am not using any html in it, it is just pure javascript.
Hi I am building a iOS app using Appcelerator,
I have a file app.js
and a file webService.js
the file webService.js contains a function x
now from my app.js
file i want to call function x
that is present in the webService.js
file.
I searched a lot but i only found that using html..i am not using any html in it, it is just pure javascript.
Share Improve this question edited Jan 2, 2012 at 10:40 Ajeet Pratap Maurya asked Jan 2, 2012 at 10:25 Ajeet Pratap MauryaAjeet Pratap Maurya 4,2543 gold badges30 silver badges46 bronze badges 2- Don't all Appcelerator apps start with an index page? You could load webService.js there. – Eugen Rieck Commented Jan 2, 2012 at 10:29
- 2 Include the file using Ti.include('webService.js); in app.js and call the function. – Muhammad Zeeshan Commented Jan 2, 2012 at 10:30
4 Answers
Reset to default 6Have you tried using
Ti.include('path/file.js');
Include the file in app.js using :
Ti.include('path/webService.js');
and call the function.
Well you can use include, but i advise you to take a look at monjs. Commonjs is the future on architecturing appcelerator's applications.
You should check this
Ti.include
is deprecated since Titanium 3.3, and it doesn't work in my environment. If you are using coffee, try coffee-concat , though it's somehow ugly.