Skip to content

Instantly share code, notes, and snippets.

@ryugoo
Created October 2, 2012 16:34
Show Gist options
  • Save ryugoo/3820772 to your computer and use it in GitHub Desktop.
Save ryugoo/3820772 to your computer and use it in GitHub Desktop.
TypeScript for Titanium Mobile test application
var MyTabGroup = (function () {
function MyTabGroup() {
this.tabGroup = Ti.UI.createTabGroup();
}
MyTabGroup.prototype.appendTab = function (params) {
for(var i = 0, l = params.length; i < l; i++) {
this.tabGroup.addTab(Ti.UI.createTab(params[i]));
}
};
MyTabGroup.prototype.open = function () {
this.tabGroup.setActiveTab(0);
this.tabGroup.open();
};
return MyTabGroup;
})();
var tabGroup = new MyTabGroup();
var win = Ti.UI.createWindow({
title: "First TypeScript",
backgroundColor: "#FFFFFF",
tabBarHidden: true
});
win.add(Ti.UI.createLabel({
text: "First TypeScript Apps for Ti!",
color: "#666666"
}));
tabGroup.appendTab([
{
title: "First TypeScript",
window: win
}
]);
tabGroup.open();
class MyTabGroup {
constructor() {
this.tabGroup = Ti.UI.createTabGroup();
}
appendTab(params) {
for (var i = 0, l = params.length; i < l; i++) {
this.tabGroup.addTab(Ti.UI.createTab(params[i]));
}
}
open() {
this.tabGroup.setActiveTab(0);
this.tabGroup.open();
}
}
var tabGroup = new MyTabGroup();
var win = Ti.UI.createWindow({
title: "First TypeScript",
backgroundColor: "#FFFFFF",
tabBarHidden: true
});
win.add(Ti.UI.createLabel({
text: "First TypeScript Apps for Ti!",
color: "#666666"
}))
tabGroup.appendTab([{
title: "First TypeScript",
window: win
}]);
tabGroup.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment