最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin12浏览0评论

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
Add a ment  | 

4 Answers 4

Reset to default 6

Have 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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论