Community Questions & Answers

How to require js file in a pure JS native module

I'm trying to create a pure JS native module for Titanium. As explained by Titanium, I have created a file in the assets folder named as my app id (*assets/comm.foo.js*). In this file, I require another file (*assets/lib/bar.js*) as follow...

require commonjs with alloy

Hi, I created a folder in the same level with controllers, models, views folder. this folder is named lib and contains : analytics.js in index.js i writed require('/lib/analytics') but i have requested module not found.. where is the problem ? thanks

CommonJS require and path.

Hello, I want to load a js module with the "require" API. require(moduleFile); moduleFile is dynamic. What is the best way to check if moduleFile file exists ? Thanks.

Require in Alloy project - seems to fail

Ok this is an easy one. Since working with Alloy, I've had issues with requiring files. So this is my folder hierarchy (relative to Resources): ~~~ app/ |_ assets/ |_ controllers/ |_ lib/ ....etc ~~~ I have a controller (in the controller folder),...

require() not working with CommonJS module

I have a module defined as such: analytics.js ~~~ function Track () { ... } ... module.exports = Track; ~~~ I am requiring the module like so: app.js ~~~ //CommonJS modules var Track = require('analytics'); zc.track = new Track(); ~~~ When I...

Alloy: require commonJS

I started a new project with alloy, (the Resources folder is hidden from the App and Project Explorer.) now i added a js file to project with path: app/models/person.js. In person.js i have: ~~~ var models = (function() { alert('hi...

Template in Alloy?

Hi! I have another problem...I would want to create an xml containing only a redefinition of LefNavButton and RightNavButton. That way, I do not have to reimplement the same component in all my views. For example : My classical view...

Alloy models folder usage

In non-alloy programs I used to put functions in a .js file inside models folder and used require to call it from my controller. controller.js ~~~ var articleModel = require('/src/models/article'); .. function imageCallBack_onSuccess(arg) { .. var exec...

Requiring widget with some properties

Hi, I am creating a widget and want to require in controller. I have done that very well. Also I have created a function in widget.js which I do call from the controller which needs to be passed some arguments which is constant. Is there any possibility...

Alloy Require requires a controller?

Hello, I am trying to implement the <Require> markup from this [example](https://github.com/appcelerator/alloy/tree/master/test/apps/basics/markup_require), as we can see middle.xml view is required and used without a controller for it. The...

SDK 3.0: require() not working anymore

Hi, I just upgraded to SDK 3.0 and now my Ti.include() works but not my require(); I have Node.js installed and everything, etc. When I start my app all I get is: [ERROR] Script Error = Couldn't find module: UI/PinGridView at app.js (line 0). I changed...

Profiling in XCode when using require

I just rewrote my entire project to use require instead of Ti.include. But now I can't use the profiler in xcode to profile my project. I get an error message: **[ERROR] Error connecting to debugger: Error Domain=NSPOSIXErrorDomain Code=61 "The...

require best practice

Hi, For a rather large framework I'm wondering what I should do with the requiring of a lot of files/modules. The framework should support iOS and Android (duh?) so I have no global scope (because that does not work on android, right?) I will be...

Is this correct or other advice?

App type: Mobile will run on Android&ios. As u know, using "require" is recommended by Titanium. Can I use a shared js file which will be required by every other files? Etc. I write some common functions and variables in common.js, and...

Ti.include variable scope into a require js

Hi, I have a problem with the Ti.include() function, each time i try to make an include i'm running into this error : [ERROR] Script Error = Can't find variable:.. Basically my app is : app.js ~~~ var Window1 =...

how do I close the a js file?

titanium sdk 1.8.2 iphone sdk 4.3 Hi, I have added a js like this: `var page = require('ui/PageView');` then created a new instance like this: `pageview = new PageView();` this works fine. The problem is closing it. I have used `hide()` and...

Showing 1-50 of 73 1 2