airamrguez / titanium-typescript

TypeScript's typings for Titanium Mobile.
7 stars 5 forks source link

Titanium Typescript

Ambient declarations for the Titanium Appcelerator API v3.1.3.GA.

var ROWS: number = 10;
var children: Array<Titanium.UI.View> = button.getChildren();

var window: Titanium.UI.Window = Titanium.UI.createWindow({
    title: 'example',
    backgroundColor: 'white'
});

var tableView: Titanium.UI.TableView = Titanium.UI.createTableView();
var dataSource: Array<Titanium.UI.TableViewRow> = [];

for (var i: number = 0; i < ROWS; i++) {
    dataSource.push(Titanium.UI.createTableViewRow({
        title: 'Row ' + i,
        hasChild: false
    }));
}

tableView.data = dataSource;

Build

To build the project:

tsc -m commonjs -t ES5 -sourcemap References.ts

The above command line generates the file Generator.js. To generate the Titanium Mobile definitions:

node Generator.js api.json > titanium.d.ts

Known issues

Future work

For future work, it would be interesting to implement interface inheritance in order to avoid repeated inherited methods or properties in subclasses.

Bitdeli Badge