Find file
Fetching contributors…
Cannot retrieve contributors at this time
92 lines (67 sloc) 2.95 KB



This app is a collection of various UI design patterns written as JavaScript modules for Titanium Mobile. This will show you how to develop and implement factory components for event driven mobile applications.

THIS IS FOR iOS ONLY. Sorry. Android support is coming next.

Screenshot 1

The Modules

Heads Up Display (HUD)

This is a basic implementation of an a heads up display, or alert view, that gracefully displays loading indicator and message.

HUD Screen Shot

Passcode Window (HUD)

This module is designed to "lock down" an app by invoking a passcode screen and prompting a user to input a 4 digit code. This is loosely based on Apple's internal passcode feature in iOS.

Passcode Screen Shot

More modules to come...

Accessing the Module APIs

To access these modules from JavaScript, you would extend your app namespace in app.js and import the module using the global require() method:

// Extend your existing app namespace for your modules to exist
MyApp.mod = {};
MyApp.mod.hud = require('modules/hud');
MyApp.mod.passcode = require('modules/passcode.mod');


HUD - MyApp.mod.hud

var HUD = MyApp.mod.hud.init(; // pass in the window to attach the HUD'YOUR MESSAGE');


init(win);      // window object (required)
show(message);  // message (optional)
  1. Initialize the module using the init() method and pass in a 4 digit number to validate against.
  2. Show a HUD by calling show(), passing an optional message to the component.
  3. You can remove a HUD by calling the hide() method.

Note: Replace 'MyApp' with your own app namespace.

Passcode - MyApp.mod.passcode

var PIN = MyApp.mod.passcode.init({code:1234,barColor:'#0079C1'});{
    // do something
    // do something


init(code,barColor);  // 4 digit number (required), barColor (optional)
open(success,error);  // success callback (optional), error callback (optional)
close();              // force close a passcode window
  1. Initialize the module using the init() method and pass in a 4 digit number to validate against.
  2. Show a passcode window by calling open(). You can optionally pass in two callbacks: "success" and "error" that will be executed on each event. This is where you can choose to allow a user to continue or not.

Note: Replace 'MyApp' with your own app namespace.


Terry Martin


This content is released under the MIT License.

Enjoy! Stay tuned for more modules being added to this project.