Community Questions & Answers
Accessing Parent Object in Alloy Applications
Hi there- I have a question on the use of the Require statement. I know that if I have any inter-controller/view communication required, I can (and do) simply fire events and listen to those events. In the case where I have a view that has a Require...
How to swap pages (js files) out of a view without keeping them in memory
First, some background: This is my first week in titanium and I'm having trouble forming a mental model for how to structure content. I have a nice table-view menu that I want to use to control all the navigation in my app. It's a sliding menu that comes...
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...
Newbie question: require() gives error "couldn't find module"
Super basic question – still on my first day of Titanium – but is there some trick to ensuring a JS file is included and available? Here's my code: ~~~ var foo = require('test.js'); ~~~ and later ~~~ var win2 = Titanium.UI.createWindow({ ...
Is UnderscoreJS Functionality Available By Default in Alloy Applications?
Hi there- Are UnderscoreJS functions/methods available by default in the Alloy framework for use? I have been trying to access the _.findWhere() function call, and I am receiving an undefined method for an iOS app. I was not sure if UnderscoreJS methods...
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
Use "else if" inside of function to use as a module.exports
I used this a version of this in a ti.include, without an problems. I am trying to figure out how use it in the ti.require module. `[ERROR] : Script Error = 'undefined' is not a function (evaluating...
Create ImageView with Functions/Methods
Dear readers, How can I create an ImageView with own defined Functions/Methods? I have a app.Designer.js file that I use in app.js by specifying `var Designer = require('ui/app.Designer');`. But I don't get the own defined Functions to...
Ti 3.0: require('ui') returns the Ti.UI module instead of ui.js
Tip for anyone else running into this: In Ti 3.0 require('ui') seems to return the Ti.UI.module instead of your own /resources/ui.js file. Same for all other Titanium modules.
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.
Build Efficiency and other time save tips
Hello everyone, My question here, is about tips and other methods to test an iPhone app as fast as possible. I've been using Titanium for a year now. I am currently using Navigation Group system on my App and to save and test changes , I have to build the...
Creater Container Alloy Views
Hello there, i'm trying to create an Alloy view to contain other views, much like a TabView or something like that. So what I want to do is something like mywindow.xml ~~~ <Alloy> <Window> <Label>All of my windows should have this...
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...
Multiple "require()" of the same module in different modules or places - is there a memory spending
I have a javascript module describing some object. I use this object multiple times in different modules in my project. For example I call var m= require("module") in first module and further call the same in other module. My question is: whether...
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...
Using Parse.com in your app
Hi Guys, So I've looked at a whole range of 'answers' to this question, but unfortunately, I'm getting errors and am not sure why. So I've added two files to the directory app/lib/ called underscore.js (has the latest underscore code) and ti.parse.js...
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 widget with native module dependency
I'm trying to create a widget which depends on native compiled module I used in the project. The module works fine when used in controllers in app folder, but nothing happens when I 'require' in inside the widget controller: var mymodule =...
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...
Where to put & how to reference a globals.js or utils.js with Alloy?
I am porting an existing Ti app to Alloy. I have a folder lib/ with a few files like globals.js and utils.js that have vars and functions that get used throughout the app. In an Alloy app, where should I put those and how should I include them? I'm not...
Tweetanium + Module Approach not working in Android ...
I am using Tweetanium like structure i.e using namespace . In this approach we have to include all file and sub files . And this is taking time , on android it taks 30-40 sec to show a window screen...So , now i am planning to do Modul ( require ) . But in...
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...
Must require Alloy and Underscore.js in CommonJS files on Android
I made a CommonJS file in my Alloy project which was imported into my Alloy controller using the standard `myAPI = require('myAPI')` bit of code. It worked fine on iOS but would fail on Android; I traced it down to calls to Alloy (e.g...
SDK 3.0 Error on iPad device with Ti.include
Dear reader, I have noticed some strange bug while testing my app on iPad 2 (iOS 6.0.1) device. ~~~ /* Render view * @param properties */ exports.render = function(view, window,...
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...
Alloy tabGroup and using require to include views into the tabs
I am testing out titanium and alloy and I can't get the windows and labels to show up in the iphone simulator no matter what. I see the tabs and can switch between them but nothing is showing up inside , just black. There is also no errors in the...
Require Device be Password Protected
Hello all, I have installed certain apps in the past that require that my phone (android) be locked with password protection in order to install/use. How can I achieve the same functionality within a Ti application? Thank you,
[ERROR] Script Error = Couldn't find module:
Anyone can tell me what's wrong with this simple change please? I can't figure it out: I have this original code working fine: ~~~ var AppTabGroup = require('ui/AppTabGroup').AppTabGroup, AppWindow = require('ui/AppWindow').AppWindow; ~~~ by adding...
Error when requiring custom classes when using iphone simulator.
Hi there, I'm trying to build a project that already works in android (works in emulator and device) for iOS. The problem is that custom modules (just classes i've created) are not recognised by the iphone when i require them. The message is: [WARN]...
Custom modules working in android but not in iPhone
Hi there, I'm trying to build a project that already works in android (works in emulator and device) for iOS. The problem is that custom modules (just classes i've created) are not recognised by the iphone when i require them. The message is: [WARN]...
Common JS and Global Scope Variables on Android
Hey guys, I've been writing an app for iPhone using Common JS and global variables. Basically my `app.js` file is as follows: ~~~ require('lib/require_patch').monkeypatch(this); var $ = { inapp: {}, facebook: { //A require of Facebook Controller -...
Calling a function over and over again.
Hey folks, I have two function which calculates width and height for EACH of my views throughout my app. Do any one know how to make the functions faster so that they run fast each time? I am using the require syntax to use functions in my main...
JSS files and require seems to conflict on Android
It seems to be a problem with the use of require() In this example only the styles from jss is applied to the window and not to the label. All files are placed in the Resources folder I am using the lastes version of Titanium Stuidio 1.0.9 and SDK...
Android does not detect an array as an instanceof Array - Bug?
Hi all, in the last weeks I refactored my app to use the `require` function instead of `Ti.include`. But I detect an issue with the `require` feature. My `instanceof` checks do no longer work. It's a bit strange and took me a long time to break it...
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...
Exact use of require() method.
Hi all, Can anybody tell me what is the exact use of the require() method and it's advantages when compared with the include() method. Thanks in advance.
Create a 'library' to be used globally, list of methods
I am looking to create a JS file that can be access from all pages of my app. This JS file is to contain common functions (check if a file exists, etc). I was thinking of creating a file (let's call it customLib.js for now) and then 'require' it in my...
A module gets loaded twice when using require
There is something I still don't understand concerning commonJS / require. If I require a module several times, this module gets loaded just once. This is OK, the expected behaviour, but there is one case where this is not true: 1. require ...
About separations (TabGroup.js, Window.js, etc.) introduced in appcelerator-titans app
Link: [git repo of appcelerator-titans](https://github.com/appcelerator-titans/App/tree/master/Community/Resources) I'm trying to copy this CommonJS template for my app, which does this thing: main window with 2 buttons, each button opens a different...
Trying to Understand Context in CommonJS (include vs. require)
I want to execute a bunch of code I store in another file using the CommonJS structure, sort of like a PHP include would do. Check out the following code example: ~~~ //==================================================== //Current context var button =...
Is there a way to detect if file inclusion is ongoing or done?
titanium mobile sdk 2.0 iphone sdk 5.1 Hi, I am including files using `require` and `Ti.include`, is there a way to know whether the current call is on-going or completed? thanks for your help.
require() path works different for web than for iOS builds
Hi, I just imported the [Community App](https://github.com/appcelerator-titans/App/tree/master/Community) to get started. I managed to compile for the iOS simulator. But when I tried to export in HTML5 I got a red screen that tells me: Failed to load...
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 =...
Ti.include() into a require() run into Error
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 =...
Modules Works in Simulator but not IPhone --- Please Help
The code below works well on the Simulator ~~~ var topView = require('ui/welcome/'+Ti.Platform.osname+'/top'); var featuredView = require('ui/welcome/'+Ti.Platform.osname+'/slider'); var menuView =...
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