Ajeet Pratap Maurya
Ajeet Pratap Maurya

Reputation: 4254

how to call a function of a javascript file from another javascript file without using HTML in titanium

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.

Upvotes: 1

Views: 3691

Answers (4)

Siwei
Siwei

Reputation: 21569

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.

Upvotes: 0

Muhammad Zeeshan
Muhammad Zeeshan

Reputation: 8856

Include the file in app.js using :

Ti.include('path/webService.js'); 

and call the function.

Upvotes: 3

Canastro
Canastro

Reputation: 3009

Well you can use include, but i advise you to take a look at commonjs. Commonjs is the future on architecturing appcelerator's applications.

You should check this

Upvotes: 0

dkulkarni
dkulkarni

Reputation: 2830

Have you tried using

Ti.include('path/file.js');

Upvotes: 6

Related Questions